bash 3.2.9, constructing array references with indirect expansion
I've been staring at Chet's message in http://www.mail-archive.com/bug-bash@gnu.org/msg01545.html for a while, and now I understand why my own script (doing something similar) was not originally working. What I can't quite figure is what to change. I'm source'ing a series of assignments of the form DIRS_name1=(/foo /bar /baz) DIRS_name2=(/qux /quux) and earlier in the file, a list of the arbitrary 'name's are assigned. Running through the list of 'name's and composing the corresponding array variable name is no trouble, but I can't manage to indirect through to the entire array. Like the person I linked to above, I keep ending up with only the first member of the array: v="DIRS_$name" declare -a a=${!v} # references through a are only scalar I also tried reconstructing a copy of the array -- I don't care how slow or inefficient that might be, it's going to be lost in the noise compared to the real work of the script -- but didn't even get that much: v="DIRS_$name" declare -a a=( "[EMAIL PROTECTED]" ) # references through a are empty The FAQ mentions that indirect expansion and arrays exist, but doesn't give examples of combining them (granted it's not that FA of a Q). Staring at the man page is how I got to where I am. :-) I've been looking at the "advanced scripting guide" but their examples of indirection are all with strings inside functions. Any advice would be appreciated.
RE: script using file dates
TMP=`ls -Aa` ; for x in $TMP ; do echo -n "$x - " ; stat $x | tac | head -1 ; echo "" ; done > I'm looking for an exisiting script, or a command to help w/ processing > files > by date. I have a test website and need to upload only the files that > have > been changed since the last upload. I'm thinking of creating a file list > and the date of the last upload. if the modified date is after the date > in > this file, it would upload. Has anyone seen a script to do this? i found > "test -nt" and "test -ot" but this is to compare two file dates, not a > file > to a stored date. ideas? thanks > - > View this message in context: > http://www.nabble.com/script-using-file-dates-tf4269542.html#a12151695 > Sent from the Gnu - Bash mailing list archive at Nabble.com. Marquis -- View this message in context: http://www.nabble.com/RE%3A-script-using-file-dates-tf4389413.html#a12514832 Sent from the Gnu - Bash mailing list archive at Nabble.com.
bash root ~/.bash_profile quirk
I have the following in my root ~/.bash_profile: PATH=$PATH:$HOME/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/BerkeleyDB.4.6/lib:/usr/local/apr/lib:/usr/lib/httpd/modules LD_RUN_PATH=$LD_RUN_PATH:/usr/local/lib:/usr/local/BerkeleyDB.4.6/lib:/usr/local/apr/lib:/usr/lib/httpd/modules PKG_CONFIG_PATH=$PKG_CONFIG:/usr/local/lib/pkgconfig:/usr/X11R6/lib/pkgconfig export PATH export LD_LIBRARY_PATH export LD_RUN_PATH export PKG_CONFIG_PATH BUT When I use su to log into root, PATH is there, LD_RUN_PATH is there, and PKG_CONFIG_PATH is there, but not LD_LIBRARY_PATH (which makes some of my programs not cooperate) Is there something I'm missing? Why would an environment variable not show up? Maybe I'm blind. Asher -- View this message in context: http://www.nabble.com/bash-root-%7E-.bash_profile-quirk-tf4389588.html#a12515328 Sent from the Gnu - Bash mailing list archive at Nabble.com.