When dealing with paths in bash i usually employ two things:
One is declaring arrays like this:
FILES_LIST=( )
And everytime I want to append to the array I go like this:
FILES_LIST=( ${FILES_LIST[@]} ${NEW_FILE} )
Obviously I will have problems if the paths or files have spaces in
their names, so in debian I would have to change the standart file
separator character. This is an environment variable so I need it back
the way it was after my script run so when I change it I make a variable
to backup and I ensure that even if my scripts crash the old file
separator variable will return as it was.
So it's like this:
IFS_DEFAULT=${IFS} #this is the environment variable
IFS_NEW=$(echo -en "\n\b") #this is a variable that makes the spaces on
filenames be treated the way I want them to
Everytime I need to change the variable (because on the same script I
need to fall back to space separators) I just put the IFS=${IFS_NEW} (no
need to export in this case) and right after the command I fallback with
IFS=${IFS_DEFAULT}.
--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4f95be36.9070...@gmail.com