Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-01-2005, 03:00 PM   #1
LQ Newbie
Registered: Jun 2005
Location: Lima, Peru
Distribution: Red Hat EE 3.0
Posts: 2

Rep: Reputation: 0
Unhappy odd error on simpe script, server may be falling apart

i have a simple script that show the current content for cron, pretty simple, and its tested OK on another identical server.
but, heres the (stupid) error that throws when run:

[root@sayri scripts]# sh
: command not found 1: clear
Seteo de permisos de archivos script
: command not found 4: date
: command not found 6: line 41: syntax error: unexpected end of file

so, how come doesnt "recognize" date or even clear
i have checked the text format with cat -v (seems ok), and bash -x shows this:

+ alias 'rm=rm -i'
+ alias 'cp=cp -i'
+ alias 'mv=mv -i'
+ '[' -f /etc/bashrc ']'
+ . /etc/bashrc
+++ id -gn
+++ id -un
+++ id -u
++ '[' root = root -a 0 -gt 99 ']'
++ umask 022
++ '[' '' ']'
+ $'clear\r'
: command not foundne 1: clear
+ echo $'--------------------------------------------------\r'
++ hostname -a
+ echo Vista de registro $'sayri\r'
Vista de registro sayri
+ $'date\r'
: command not foundne 4: date
+ echo $'--------------------------------------------------\r'
+ $'\r'
: command not foundne 6:
' line 29: syntax error near unexpected token `in
' line 29: ` case $CRON in

the only change i have done is add the script folder to the path and chmo'ed to 777
any help will be greatly appreciated


(original script)
echo --------------------------------------------------
echo Vista de registro `hostname -a`
echo --------------------------------------------------

if [ "$USERNAME" != "root" ];then
echo " "
echo "Debe ser root para correr este script."
echo "Ingrese como root y re ejecute este script para continuar."
echo " "
exit 1

cd /
echo " "
echo "-- Mostrando valores actuales usuario root --"
crontab -u root -l|grep sh

echo " "
echo "-- Mostrando valores actuales usuario oracle --"
crontab -u oracle -l|grep sh

while :

Old 06-01-2005, 04:11 PM   #2
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
One of three conditions must be met for the script to work.
1) The paths to the clear and date commands must be in the path of the user executing the script.


2) the script must be in the directory wherein lies the clear and date commands - difficult to do since they're probably if different directories.


3) edit the script to include the full path to the clear and date executable, so that bash knows where to find them.

Open a terminal and run:
which clear; will probably return /usr/bin/clear
which date; will probably return /bin/date

Edit the script to include those paths, and it should work.
Old 06-01-2005, 08:56 PM   #3
LQ Newbie
Registered: Jun 2005
Location: Lima, Peru
Distribution: Red Hat EE 3.0
Posts: 2

Original Poster
Rep: Reputation: 0
sure your trick could help overcome the situation
but, you now theres something funny about it
i shouldnt happen maybe something has changed to the worse

a tip i have just discover
reviewing the path, it shows double routes, meaning, PATH=/usr/bin:/usr/bin/:/bin:/bin etc

any help will be greatly apreciated
thanks all


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel Install Odd Error inescapeableus Linux - Software 13 10-22-2005 06:11 PM
FAQ: Internal Server Error / Premature End of Script Header / MS-DOS Carriage Return rebel Red Hat 2 04-30-2005 03:11 PM
odd grub error on first boot kaider Slackware - Installation 7 01-27-2005 08:48 PM
Odd error during boot up, never seen this before [42]Sanf0rd Linux - General 2 06-26-2004 05:42 PM
MySQL error, my hair is falling out! cosmicperl Linux - Software 6 09-01-2003 07:41 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:41 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration