writing a basic script to do some sample tasks

writing a basic script to do some sample tasks

Post by K » Fri, 08 Mar 2002 03:58:38



I'm trying to write a very basic shell script and then run it.
I'm using Linux 7.2 RH with bash shell. Can somemone tell me how do I
do that?

This is the only text in my update.sh (or update.bash) file
_________________________________

cd /cvs
cvs update -dP ./project/website
cp /cvs/project/website/html/*.*
/usr/local/httpd/htdocs/projectcenter/docs/
________________________________
but when I run it using this command

    /cvs/update.bash      

I get this error:

: command not found
update from cvs
: command not found
: No such file or directory
: no such repository
cp: copying multiple files, but last argument
`/usr/local/httpd/htdocs/projectcenter/docs/\r' is not a directory
Try `cp --help' for more information.
: command not found
done
: command not found
bash-2.05#

Is there something wrong with my scripts or the way I run it? I've
done a chmod 777 on that file too.  Do I need  to make that file
available on my path, and how do I do that?

Thanks.

 
 
 

writing a basic script to do some sample tasks

Post by Barry Margoli » Fri, 08 Mar 2002 04:13:30




>I'm trying to write a very basic shell script and then run it.
>I'm using Linux 7.2 RH with bash shell. Can somemone tell me how do I
>do that?

>This is the only text in my update.sh (or update.bash) file
>_________________________________

>cd /cvs
>cvs update -dP ./project/website
>cp /cvs/project/website/html/*.*
>/usr/local/httpd/htdocs/projectcenter/docs/
>________________________________
>but when I run it using this command

>    /cvs/update.bash      

>I get this error:

>: command not found

My guess is that you wrote the script on a Windows box and transferred it
to the Linux box, but forgot to set ASCII mode when you transferred it.  So
it still has the Windows CR characters before all the newlines.

--

Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

writing a basic script to do some sample tasks

Post by Yohanes Santos » Fri, 08 Mar 2002 05:16:59


Put 'set -x' at the beginning of the script to help debugging the script.


> cd /cvs
> cvs update -dP ./project/website
> cp /cvs/project/website/html/*.*
> /usr/local/httpd/htdocs/projectcenter/docs/

should be either:

cp /cvs/project/website/html/*.* /usr/local/httpd/htdocs/projectcenter/docs/ #all in one line

or

cp /cvs/project/website/html/*.* \
/usr/local/httpd/htdocs/projectcenter/docs/ #proper line-splitting

Also, if you are new to UNIX shell, please be warned the equivalent of
*.* in dos prompt is * in UNIX shell which means everything.

*.* in UNIX shell means files&dirs that have dot(s) in their names.

Quote:> cp: copying multiple files, but last argument
> `/usr/local/httpd/htdocs/projectcenter/docs/\r' is not a directory

                                              ^^
Remove the \r character. dos2unix may help.

YS.

 
 
 

1. Basic script writing in a Korn shell

I am brand new to unix and I need to write a script to check a directory and
notify me if there are more than x number of files.

I am on AIX version 4 and am using the korn shell. (I didn't even know these
words before today)

I cannot get "ed" to work right. Can I write it in notepad as a startup
script for Novell's Host Presenter?

Please respond assuming I know nothing, cause I'm not far from it.

Thanks

2. kernel version 2.5.52 / Slackware8.1

3. Scripting FTP tasks - How to use FTP in bash scripts

4. setting ipg > MAXIPG on a filesystem?

5. Sample Client and Server programs (Basics)

6. chown problem

7. Basic - ideas for task priorty of Report Writer

8. Dropped packets with 3Com cards and 2.4 kernel

9. NIS basic sample wanted

10. Help with Basic SysAdmin task

11. Bash Scripting: Little help with basic scripting

12. DOS/Linux Connectivity Task Involving PCMCIA Network Card

13. Line printer writing locks task