Skip to main content

Thread: blank space in directory name giving errors


hi have many directories have blank space in names.i have scripts run on them.
here example script

code:
    #!/bin/bash      docid='/home/deel/pdf/rant/spr 2008 shree rose visheshank'      p=1      while [ $p -lt 117 ];      cp $docid/$p.pdf ./      p=$p+1      done
upon executing above script error

code:
    cp: cannot stat `/home/deel/pdf/rant/spr': no such file or directory      cp: cannot stat `2008': no such file or directory      cp: cannot stat `shree': no such file or directory      cp: cannot stat `rose': no such file or directory      cp: cannot stat `visheshank/1.pdf': no such file or directory      ./d2.sh: line 5: [: 1+1: integer expression expected
what changes suggest can take blank space in directory names.i have tried using double quotes "" results same.

check out bashfaq 020 , bashpitfalls 002 (links in signature) , http://mywiki.wooledge.org/arithmeticexpression.

code:
#!/bin/bash    docid='/home/deel/pdf/rant/spr 2008 shree rose visheshank'  p=1    while (( p < 117 ));      cp -- "$docid/$p.pdf" ./      ((p++))  done


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk blank space in directory name giving errors


Ubuntu

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account