One more comment on bash with spaces

Tony Baechler tony at baechler.net
Sun Aug 2 09:10:39 UTC 2015


To follow up on the previous thread here about how awkward it is to use bash 
with spaces, I just read about someone on the ubuntu-users list who was 
having a problem with his backup strategy not working.  He has a cron job to 
automatically make an archive which is stored on his external drive.  The 
path to his external drive has spaces.  Because of how cron works, the 
quotes were somehow being stripped, causing the archives to be corrupted, 
even though they worked fine from the command line.  The moral of the story 
is that even when you are quoting everything, it doesn't always work.  Once 
he removed the space, his cron job worked fine.  Yes, I realize cron uses 
/bin/sh which is not always linked to bash.  This is also a good reminder to 
test your scripts before using them in production.  I usually put "echo" at 
the beginning of the command I want the script to execute (such as in a 
loop) to make sure it does what I expect.


--------------------
Tony Baechler, Baechler Access Technology Services
Putting accessibility at the forefront of technology
mailto:bats at batsupport.com
Phone: 1-619-746-8310   Fax: 1-619-449-9898




More information about the Blinux-list mailing list