A stupid, maybe , question:
HOW can i prevent BASH to expand FileSystem integration when using special chars inside a command?
I mean, having the /tmp looks like this,
Code: Select all
/tmp
├── dir
│ └── test2
└── test
Now, i want to simply apply a for cycle with my strings, without having them expanded to FileSystem,
Code: Select all
s="/tmp/* /tmp/dir/*"
for f in $s;do echo "$f";done
/tmp/dir
/tmp/test
/tmp/dir/test2
The for command expands my string to a FileSystem expanded object!!!
What i need is a simple,
OUTPUT:
/tmp/*
/tmp/dir/*
The only way i found is to trick the system and add a "pattern" to exlude FileSystem expansion,
Code: Select all
s="^/tmp/* ^/tmp/dir/*"
for f in $s;do echo "${f/^/}";done
/tmp/*
/tmp/dir/*
Is there another way, OS/Bash level, to make this expansion disabled?
Thanks.