[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] for File in Folder_Variable_Name Expansion

From: Roger
Subject: [Help-bash] for File in Folder_Variable_Name Expansion
Date: Sun, 15 Dec 2013 13:28:24 -0900
User-agent: Mutt/1.5.21 (2010-09-15)

$ FOLDER="${HOME}/Books/Learning?C/cse142/Lecture1/Files/slides/"; for file in 
"${FOLDER}"/*.jpg; do echo "${file}"; done


$ FOLDER="${HOME}/Books/Learning?C/cse142/Lecture1/Files/slides/"; 
FFOLDER="${FOLDER}/*.jpg"; for file in "${FFOLDER}"; do echo "${file}"; done


I've read multiple forum posts, and they've all worked around or suggested (or 
deterred) the usage of eval.  (ie. $(eval echo "${FOLDER}") )

(However, notice even the "eval" output will be interrupted by the whitespace 
in folder/directory names, rendering the output useless.)

I have some ideas, and of them thinking just declaring the "name" for the "for" 
command a static value. (ie. "for FILE in /path/to/folder/*.jpeg")

(Read the Bash Manual and didn't notice any mention of possible problems using 
a concatenate variable name for "name" for the "for" command.)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]