开发者

Regarding shell script -env variables

开发者 https://www.devze.com 2022-12-21 05:40 出处:网络
Have a shell sc开发者_Go百科ript that reads the files in a particular directory. #!/bin/bash for fspec in /exp/dira/test/ready/* ; do

Have a shell sc开发者_Go百科ript that reads the files in a particular directory.

#!/bin/bash
for fspec in /exp/dira/test/ready/* ; do
done

I want to modify the unix shell script so that path is retreived from enviornmental variable.

export CUST_DATA=${_FX_DATA_}/test have set this variable in environment thru .profile

#!/bin/bash
READY_FILES= "$CUST_DATA/ready"
for fspec in $READY_FILES/* ; do
done

i tried the above but it's not working.


The space after the equal sign makes it mean something completely different.

#!/bin/bash
READY_FILES="$CUST_DATA/ready"
for fspec in "$READY_FILES"/* ; do
  ....
done


    #!/bin/bash
    . ~/.profile
    READY_FILES="$CUST_DATA/ready"
    for fspec in $READY_FILES/* ; do
     ...
    done


add echo "<$CUST_DATA>" to your second script to make sure that variable is not set.

0

精彩评论

暂无评论...
验证码 换一张
取 消