bash scripting: filenames with spaces
Hello,
here is a simple script I use to show how "select" works: #!/bin/bash OPTIONS="Quit `ls`" PS3="Which file do you want to know more about? " select op in $OPTIONS do if [ "$op" = "Quit" ]; then echo "See you!" exit 0 else file "$op" fi done But this has a problem when a filename has spaces. It appears on the menu like two diferent options instead of one. I tried to use "ls -Q" or "ls -b" to protect these names, but it doesn't work. Do you know how to solve it? Thanks in advance, JoanQ |
Code:
#!/bin/bash |
Thanks Hko!
It was easy but I didn't think of it... |
All times are GMT -5. The time now is 11:40 PM. |