LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Trouble in Shell Script (http://www.linuxquestions.org/questions/linux-general-1/trouble-in-shell-script-122107/)

Gerardoj 12-02-2003 08:30 PM

Trouble in Shell Script
 
Hi. Im creating a simple install shell script, but I have a problem that doesnt copy any GIF file, Im trying to copy all the contents of the NotepadIcons folder. The below code is part of my script. What could be the problem?

Thanks

Code:

su -c "mkdir -p /usr/share/NOTEPAD-EDITOR-1.01/NotepadIcons && cp *.gif "

Tinkster 12-02-2003 08:38 PM

The problem is that you don't
cd into the directory, and that
cp doesn't have a target.



Cheers,
Tink

LogicG8 12-02-2003 08:40 PM

you need to add a directory as an argument to cp

su -c "mkdir -p /usr/share/NOTEPAD-EDITOR-1.01/NotepadIcons && cp *.gif /path/to/someplace/"

Gerardoj 12-02-2003 09:49 PM

I changed it for

Code:

su -c "mkdir -p /usr/share/NOTEPAD-EDITOR-1.01/NotepadIcons && cp -r *.gif /usr/share/NOTEPAD-EDITOR-1.01/NotepadIcons/"
and cp: cannot stat `*.gif': No such file or directory appears me. now what could be the problem?

Thanks

Tinkster 12-02-2003 09:53 PM

As you su -c
the current dir changes.

you'll need to mkdir && cd <where gifs are> && cp



Cheers,
Tink

homey 12-02-2003 09:56 PM

Quote:

The problem is that you don't
cd into the directory, and that
cp doesn't have a target.
I agree with Tinkster cause you make the directory, then jump to the cp command without getting into the directory which has the gif files. You also don't say where to copy things to.

Gerardoj 12-02-2003 10:21 PM

Thanks for Your Reply, I changed it and now is working fine.


All times are GMT -5. The time now is 04:24 AM.