[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] for File in Folder_Variable_Name Expansion
From: |
rogerx . oss |
Subject: |
Re: [Help-bash] for File in Folder_Variable_Name Expansion |
Date: |
Mon, 16 Dec 2013 04:58:01 -0900 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
> On Mon, Dec 16, 2013 at 04:33:58AM -0900, Roger wrote:
>
>This was the crux of my problem here. Although the whitespace/space within
>the
>folder (or filename, or path) was an initial issue until I used a wildcard (or
>globbing, or "*", or "?") for substitution of the whitespace.
>
>This main issue of "for FILE in /PATH/*.jpg" was really difficult, as I always
>prefer using global variables instead of statically assigned data. (As most
>others likely do too.) I was thinking this should just work when written as
>"for FILE in /PATH/*.jpg" as it appeared syntactically correct compared to
>other variable usage or other variable assignments. (ie. printf
>"${HOME}/file.jpg")
>
>Amazingly, all the previous answers posted provided a specific answer to each
>specific problem I encountered with my scripting here, as well as each
>follow-up providing some really clearly interpretable explanations of what I
>was seeing from my perception of the problem. Without each of the previous
>posts, I would have been still been left with some further questions. (A
>spectacular thread here, compared to the other explanations posted elsewhere!)
>
>About the only question remaining, is why some bash commands (or functions) do
>not uniformly accept variable expansion similar to using within printf or
>echo.
>(ie. printf "${HOME}/file.jpg") But suspect every command handles expansion
>based on each commands programmed method of handling a variable expansion.
>
>Looking back over the Bash Manual, I see printf or echo listed under the
>"SHELL
>BUILTIN COMMANDS" category, and the "for" command categorized under "SHELL
>GRAMMAR > Pipelines". As such, each category of commands, handles expansion
>differently?
CORRECTION: The "for" command falls under "SHELL GRAMMAR > Compound Commands"
within the Bash Manual. (While printf/echo are under "SHELL BUILTIN
COMMANDS".)
--
Roger
http://rogerx.freeshell.org/
Re: [Help-bash] for File in Folder_Variable_Name Expansion, Roger, 2013/12/16