[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-developers] Shell Script Errors



You might get this kind of weird errors if you have developed the script
on windows platform, and then have moved it over to UNIX/Linux.

On Windows, each line ends with \r\n, while on Unix/Linux it ends with
\n only.
If this is the case, get rid of the all '\r' and you should be fine.

Regards,
--Stas

Kevin Thomson wrote:
> 
> Alright, I'm writing a simple shell script to execute a few commands based
> on what time of day it is, after fixing the outdated and stripped down
> version of the date command cobalt has on its Qube3's I managed to get the
> command line to start printing out times via 'date +%H%M' (to print out
> Hour:Minute) but now I'm having problems with my case statments and I'm not
> sure why its happening. Below I'm stating the exact instances where I'm
> having problems:
> 
>         [root /root]# sh qubebackup-0.4.sh
> I run the shell script, it starts printing errors
> 
>         : command not found
>         : command not found
>         : command not found
>         : command not found
>         : command not found
>         "t: unknown command "status
> 
> To this point there are no commands being issued, I'm setting variables
> like:
> BUFSIZE="32k"
> DOW=`date +%w`
> TIME='date +%H:%M'
> HOUR='date +%H'
> DATE=`date +%D`
> DAY=`date +%A`
> DEVICE="/dev/nst0"
> DATA="/home"
> REWIND="mt -f /dev/nst0 rewind"
> EOD="mt -f /dev/nst0 eod"
> FSF="mt -f /dev/nst0 fsf"
> 
>         usage: mt [-v] [--version] [-h] [ -f device ] command [ count ]
>         commands: weof, wset, eof, fsf, fsfm, bsf, bsfm, fsr, bsr, fss, bss,
> rewind,
>                 offline, rewoffl, retension, eod, seod, seek, tell, status,
>                 erase, setblk, lock, unlock, load, compression, setdensity,
>                 drvbuffer, stwrthreshold, stoptions, stsetoptions,
> stclearoptions,
>                 defblksize, defdensity, defdrvbuffer, defcompression, sttimeout,
>                 stlongtimeout, densities, setpartition, mkpartition, partseek,
>                 asf.
> 
> I'm not quite sure WHY its printing this out considering its in responce to:
> mt -f /dev/nst0 status
> which should give me an echo of the status of the non rewinding device.
> 
>         : command not found
> 
> Here this is again... I'm going crazy, I swear.
> 
>         'ubebackup-0.4.sh: syntax error near unexpected token `in
>         'ubebackup-0.4.sh: qubebackup-0.4.sh: line 63: `case "$TIME" in
> 
> This one I really don't get, its in reponce to my case statement:
> case "date +%H:%M" in
>         10:00) bru -L "${TIME}'s Hourly Backup" -cvvvVZXGBf \
>                         $DEVICE $DATA > /tmp/backup.txt
>                    mail $MAILLIST < /tmp/backup.txt
>         ;;
>         12:00) bru -L "${TIME}'s Hourly Backup" -cvvvVZXGBf \
>                         $DEVICE $DATA > /tmp/backup.txt
>                    mail $MAILLIST < /tmp/backup.txt
>         ;;
>         "14:00) bru -L "${TIME}'s Hourly Backup" -cvvvVZXGBf \
>                         $DEVICE $DATA > /tmp/backup.txt
>                    mail $MAILLIST < /tmp/backup.txt
>         ;;
>         "16:00") bru -L "${TIME}'s Hourly Backup" -cvvvVZXGBf \
>                         $DEVICE $DATA > /tmp/backup.txt
>                    mail $MAILLIST < /tmp/backup.txt
>         ;;
>         18:00) bru -L "${TIME}'s Hourly Backup" -cvvvVZXGBf \
>                         $DEVICE $DATA > /tmp/backup.txt
>                    mail $MAILLIST < /tmp/backup.txt
>         ;;
>         *) exit *
> esac
> 
> Am I going insane? Can someone help me out? I mean this should be working,
> simple line by line from any good linux developers book would tell me that,
> so I must be missing something.
> 
> _______________________________________________
> cobalt-developers mailing list
> cobalt-developers@xxxxxxxxxxxxxxx
> http://list.cobalt.com/mailman/listinfo/cobalt-developers

-- 
This e-mail, and any attachments thereto, is intended only for use by 
the addressee(s) named herein and may contain legally privileged and/or 
confidential information.  If you are not the intended recipient of 
this e-mail, you are hereby notified that any dissemination, 
distribution or copying of this e-mail, and any attachments thereto, is 
strictly prohibited.  If you have received this e-mail in error, please 
immediately and permanently delete the original and any copy of any 
e-mail and any printout thereof. 
  

Accelerate your Linux® application development with Kylix (TM), the RAD 
tool for Linux. Easily integrate web, desktop and database development 
to quickly deliver fast Linux applications. Kylix is the only Linux 
development tool that combines the world's fastest compiler with the 
most productive visual design environment for GUI, web and database 
programming. Order your copy now! 
http://www.borland.com/kylix/