Changeset 33776


Ignore:
Timestamp:
2019-12-09T15:41:08+13:00 (4 years ago)
Author:
ak19
Message:

Field Separator (IFS) conflicting with backticks and other ways of getting command output. According to https://unix.stackexchange.com/questions/159053/a-tiny-and-simple-script-fail-and-this-is-the-output-no-such-file-or-directory, having customised the IFS to an empty line, the command inside subsequent backticks operator (or other way of getting cmd output) is not run with the first string inside the backticks and subsequent strings passed as args, but the entire set of strings is interpreted as the command to run. And then I get a No Such File or Directory message. Setting and unsetting the IFS locally just before running backtick commands did not make a difference for any of the values of IFS I could think of. Correcting this in the only way I could get it to work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/gti/translation_status.sh

    r31961 r33776  
    3838for file in ${filelisting[@]}; do
    3939    if [[ "$file" != *"zz"* && "$file" != *"test"* ]]; then
    40     `svn up $file` # let's update the files first
    41     status=`svn status $file`
     40    # let's update the files first
     41    #`svn up $file`
     42    svn up $file > /dev/null
     43    #status=`svn status $file`
     44    svn status $file > tmpstatus.txt
     45    status=`cat tmpstatus.txt`
    4246    # "LINE: $file - status: $status"
    4347    # if the file's svn status is modified, write the filename out to the report
     
    6367for file in ${filelisting[@]}; do
    6468    if [[ "$file" != *"zz"* && "$file" != *"test"* ]]; then
    65     status=`svn status $file`
     69    #status=`svn status $file`
     70    svn status $file > tmpstatus.txt
     71    status=`cat tmpstatus.txt`
    6672    if [[ "$status" == *"? "* ]]; then
    6773        #echo "$file has been added: $status"
     
    102108
    103109
    104 
    105 
    106110# restore IFS
    107111IFS=$IFS_BAK
     
    123127fi
    124128
     129
     130# delete tmp files
     131rm tmpstatus.txt
     132
     133
    125134# Debugging
    126135# print env vars
Note: See TracChangeset for help on using the changeset viewer.