LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-02-2004, 08:36 PM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 31
run script error


I try to run a new script on the RH linux shell , it always pop the sign "##4" to each line , but I can run the same script on other shell , what is wrong in my system ? please suggest , thx in advance.


____________________________

##4who -u
##4awk '{ print $6":"$7 }'
##4grep -v '\.'
_____________________________
 
Old 09-02-2004, 08:41 PM   #2
serz
Member
 
Registered: Apr 2003
Location: Buenos Aires, Argentina
Distribution: Slackware, Gentoo
Posts: 397

Rep: Reputation: 30
# are comments in bash scripting, so that won't work, at least in bash...
 
Old 09-02-2004, 09:08 PM   #3
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
I hv a line "#!/bin/bash" at the beginning of the script , but still not work , what can I do now ? please suggest , thx.
 
Old 09-03-2004, 09:38 AM   #4
serz
Member
 
Registered: Apr 2003
Location: Buenos Aires, Argentina
Distribution: Slackware, Gentoo
Posts: 397

Rep: Reputation: 30
Could you please post the whole script?

You need to remove those ###4...

Code:
#!/bin/bash

who -u
awk '{ print $6":"$7 }'
grep -v '\.'
 
Old 09-06-2004, 01:58 AM   #5
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
the script as below.
 
Old 09-06-2004, 02:01 AM   #6
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
#!/bin/bash

set -x
for user1 in `who -u | awk '{ print $6":"$7 }' | grep -v "\."| awk -F : '{ print
($1*60)+$2":"$3 }'`

do

time=`echo $user1 | awk -F ":" '{ print $1 }'`
pid=`echo $user1 | awk -F ":" '{ print $2 }'`

if [[ $time -gt 360 ]]
then
kill -9 $pid
fi
done
 
Old 09-06-2004, 10:54 AM   #7
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
what is wrong with the script ? please advise , thx
 
Old 09-09-2004, 08:44 AM   #8
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
I still can't hv the error , could suggest what is wrong with my script ? thx.
 
  


Reply


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
run-parts gives error on bash script ChoKamir Programming 9 04-11-2017 07:18 AM
Error after editing /etc/rc/rc.local, Fedora freezes when tries to run the script simeandrews Fedora 1 06-24-2005 10:52 AM
on Network Up Script run? On Battery power run script? v2-ncl Linux - General 0 12-08-2003 09:34 AM
can't run a script script from icon in konqueror scottsteibel Linux - Software 1 08-02-2003 07:59 PM
Script does not want to run, error rhuser Programming 15 03-06-2003 05:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:20 AM.

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