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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
09-02-2004, 08:36 PM
|
#1
|
Senior Member
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130
Rep:
|
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 '\.'
_____________________________
|
|
|
09-02-2004, 08:41 PM
|
#2
|
Member
Registered: Apr 2003
Location: Buenos Aires, Argentina
Distribution: Slackware, Gentoo
Posts: 397
Rep:
|
# are comments in bash scripting, so that won't work, at least in bash...
|
|
|
09-02-2004, 09:08 PM
|
#3
|
Senior Member
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130
Original Poster
Rep:
|
I hv a line "#!/bin/bash" at the beginning of the script , but still not work , what can I do now ? please suggest , thx.
|
|
|
09-03-2004, 09:38 AM
|
#4
|
Member
Registered: Apr 2003
Location: Buenos Aires, Argentina
Distribution: Slackware, Gentoo
Posts: 397
Rep:
|
Could you please post the whole script?
You need to remove those ###4...
Code:
#!/bin/bash
who -u
awk '{ print $6":"$7 }'
grep -v '\.'
|
|
|
09-06-2004, 01:58 AM
|
#5
|
Senior Member
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130
Original Poster
Rep:
|
the script as below.
|
|
|
09-06-2004, 02:01 AM
|
#6
|
Senior Member
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130
Original Poster
Rep:
|
#!/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
|
|
|
09-06-2004, 10:54 AM
|
#7
|
Senior Member
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130
Original Poster
Rep:
|
what is wrong with the script ? please advise , thx
|
|
|
09-09-2004, 08:44 AM
|
#8
|
Senior Member
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130
Original Poster
Rep:
|
I still can't hv the error , could suggest what is wrong with my script ? thx.
|
|
|
All times are GMT -5. The time now is 11:20 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|