0

I've try next script

#!/bin/bash
VERSION="2.0.3.44"
BUILD_NUMBER=${VERSION##*.}
BUILD_QUERY="${BUILD_NUMBER}/foo/bar/"

Expected result:

44/foo/bar/

Actual result:

/foo/bar/

Has anyone come across this?

Cyrus
  • 84,225
  • 14
  • 89
  • 153
Alesia
  • 49
  • 1
  • 4
  • 1
    What OS are you on? I've just tried it on macOS X terminal and echo $BUILD_QUERY works perfectly fine – Faisal Rahman Avash Jun 19 '19 at 10:23
  • 1
    And post the SHELL you are using (`echo $SHELL `). Under Arch Linux with zsh this works also perfectly fine. `zsh --version` -> `zsh 5.7.1 (x86_64-pc-linux-gnu)` – zzeroo Jun 19 '19 at 10:24
  • Ubuntu 14.04.6 LTS. `bash --version` -> `GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)`, `echo $SHELL` -> `/bin/bash` – Alesia Jun 19 '19 at 10:30
  • Works fine under `GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu).`. –  Jun 19 '19 at 10:43
  • Works fine with bash 4.2.53 and 4.3.30, too. – Cyrus Jun 19 '19 at 10:44
  • Check if the dot is there in your second line. –  Jun 19 '19 at 10:45
  • Try to replace `#!/bin/bash` with `#!/bin/bash --norc`. – Cyrus Jun 19 '19 at 10:48
  • 2
    If it still doesn't work, maybe you ought to paste the output from `xxd < the_script` here. –  Jun 19 '19 at 10:49

0 Answers0