Question
I have attempted to run the following bash script on my internet tablet (Nokia N810 running on Maemo Linux). However, it doesn't seem that it is running, and I have no clue of what's wrong with this script (it runs on my Ubuntu system if I change the directories). It would be great to receive some feedback on this or similar experiences of this issue. Thanks.
WORKING="/home/user/.gpe"
SVNPATH="/media/mmc1/gpe/"
cp calendar categories contacts todo $WORKING
Solution
What actually happens when you run your script? It's helpful if you include details of error messages or behavior that differs from what's expected and in what way.
If $WORKING contains the name of a directory, hidden or not, then the cp
should copy those four files into it. Then ls -l /home/user/.gpe
should show them plus whatever else is in there, regardless of whether it's "hidden".
By the way, the initial dot in a file or directory name doesn't really "hide" the entry, it's just that ls
and echo *
and similar commands don't show them, while these do:
ls -la
ls -d .*
ls -d {.*,*}
echo .*
echo {.*,*}
OTHER TIPS
The bash cp
command can copy multiple sources to a single destination, if it's a directory.
Does the directory /home/user/.gpe
exist?
Bear in mind that the leading dot in the name can make it hidden unless you use ls -a
I tried your commands in cygwin:
But I used .gpe
instead of /home/user/.gpe
I did a touch calendar categories contacts todo
to create the files.
It worked fine.
If that's the entirety of your script, it's missing two. possible three, things:
- A shebang line, such as
#!/bin/sh
at the start - Use of $SVNPATH. You probably want to
cd $SVNPATH
before thecp
command. Your script should not assume the current working directory is correct. - Possibly execute permission on the script:
chmod a+x script
Do you already have the /home/user/.gpe directory present? And also, try adding a -R parameter so that the directories are copied recursively.