When I lowercase with tr and update the value the new value is not there

时间:2019-03-19 15:00:08

标签: bash

I am using build.spec aws beanstalk for my build project and here is my bash script:

      - stg="$STG.js"
      - stg= $stg | tr '[:upper:]' '[:lower:]'
      - cat deployment-config/$stg >> src/tj-paths/pathExtensions.js

I pass Stg3 for $STG and after the following line:

stg= $stg | tr '[:upper:]' '[:lower:]'

I expect stg to have the value of stg3 rather than Stg3

But still the value is Stg3 Any idea?

1 个答案:

答案 0 :(得分:0)

尝试一下:

STG="TeStNaMe"

stg="$STG.js"
echo "  original: $stg"

stg=$(echo "$stg" | tr '[:upper:]' '[:lower:]')
echo "lower case: $stg"

输出:

  original: TeStNaMe.js
lower case: testname.js