开发者

Regarding shell script -env variables

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜