This will be an easy one, but in my memories, when shell scripting, using double quotes would allow expanding globbing and variables.
But in the following code:
#!/bin/sh
echo *.sh
echo "*.sh"
echo '*.sh'
echo $LANG
echo "$LANG"
echo '$LANG'
I get this result:
bob.sh redeployJboss.sh
*.sh
*.sh
en_US.utf8
en_US.utf8
$LANG
So single quoting prevent glob AND variable expansion but double quoting allows only variable expansion and no globbing?
Can I glob in any quoting pattern?
echo "$hello and $goodbye".*
(mix variable expansions, spaces, and a glob in the same "word". – vonbrand Mar 13 '13 at 13:57echo /path/to/file/*${variable}
. How do I glob while appending an interpolated email? – CMCDragonkai Feb 05 '16 at 07:36echo "$FOLDER_PATH"/*.extension
works fine for me, contrary to the accepted answer, I had to remove the whitespace between the"
and the*
. Hope it helps. – LostBalloon Mar 10 '16 at 18:50(cd "$FOLDER_PATH" && echo *.extension)
– Steven Darnell Nov 03 '18 at 02:49