Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
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.
|
 |
11-02-2002, 02:59 AM
|
#1
|
Member
Registered: Mar 2002
Posts: 75
Rep:
|
exit
anyone knows how to use the exit command in shell scripting
like for example.. if i was to give someone a shell acc.. they would have to
enter there passwd to loggin right.. well i want it so that the script that i have will ask them for another secret pass.. and if they get it wrong.. then it will log them off the shell
|
|
|
11-02-2002, 08:12 AM
|
#2
|
Moderator
Registered: May 2001
Posts: 29,415
|
Not an answer to your question, but in the security sense of it all that doesn't make much sense, because the person has to know/bruteforce 2 passes, one of them being in the script that handles logins if I follow your previous scripting spree :-]
What does having 2 passes protect you against? Nothing. For instance if they share their passes amongst friends/fellow crackers it wouldn't matter, wouldn't it?
Furthermore, since you're not prolific in shell scripting, is it safe to assert you are no experienced Linux user as well? If so, then it would be advisable to first look into securing your box against attacks, because if you invite ppl onto your system you can't fully trust there always will be some who will go that extra mile to gain root an easy way, and already having a local account makes it easier to probe for apps with a bad rep or try out new stuff.
Ok, that said, the bash builtin is called "logout" (man bash) and it will only work in the login shell, $SHLVL -ge 1 shells use "exit".
Need stupid example?: "if the (supplied value for) pass1 doesn't match (value for) pass1, or if the (supplied value for) pass2 doesn't match (value for) pass2, then logout", which translates in bashspeak to:
if [ "$pass" != "pass" -o "$secret_pass" != "secret_pass" ]; then logout; fi
|
|
|
11-02-2002, 09:46 AM
|
#3
|
Member
Registered: Mar 2002
Posts: 75
Original Poster
Rep:
|
no it is not for my shell .. it is for project.. a scholl project.. if it was like that then i would off just modified bashrc or created a prob in c or someting.. im new to shell scripting... im not stupid enough to actualy let someone ssh to me if i dont know who that person is or if i didnt know how to secure it.. (btw my box is well secured just in case =) ) i really didnt think i hade to explain my self in this way.. but i guess i should of in the first place.. well anyways.. thanx for your worm reply 
|
|
|
11-02-2002, 12:05 PM
|
#4
|
Moderator
Registered: May 2001
Posts: 29,415
|
This definately is a sad joke.
I really don't like it when I find out I have been wasting my time providing answers for people who are sposed to study this but rather stoop to letting other ppl solve their probs for them.
|
|
|
11-02-2002, 07:08 PM
|
#5
|
Member
Registered: Mar 2002
Posts: 75
Original Poster
Rep:
|
No i didnt ask for people to solve my problem .. all i ask was for some help .. but if asking for some help in this forum..is a crime.. then i guess this forum is not worth posting at all.. you didnt waist your time.. posting a reply to my post.. but you should rethink what you are saying.. AGAIN i didnt ask anyone to solve the problem.. all i ask was for some help.. is this possiable in this forum? or NOT? cause from what it sounds like... it is not..
asking to solve your prob is one thing.. asking for help is another.. thanx have a good day 
Last edited by xlord; 11-02-2002 at 07:14 PM.
|
|
|
11-03-2002, 06:37 AM
|
#6
|
Moderator
Registered: May 2001
Posts: 29,415
|
Look, you miss my point. I'll support anyone's quest for knowledge good or bad, so it's not in the asking for assistance, hits, advice, help, solution etc etc whatever's in a name.
What I mean is it's the fact that you didn't tell upfront this was for a school project. I just don't like to find out I'm helping ppl with an assignment/project/whatever when they're sposed to be learning that stuff themselves.
Just my opinion, other board members may not agree, also note I'm not writing this as moderator but as your average LQ board member,
---
not applicable where forbidden by law, firearms allowed on premises, hang coat in hallway, wash hands before dinner, firm members excluded.
|
|
|
11-03-2002, 10:14 AM
|
#7
|
Member
Registered: Mar 2002
Posts: 75
Original Poster
Rep:
|
i admit at one point you are correct.. but in another i am also... im sorry that i was not a bit more complete.. but sometimes even a great coder needs help.. i just needed to know the syntax on how to be able to do with an exit command that will log out a user of shell.. Sometimes its hard for me to even sit down and start reading book's for the fact that i have to work and take care of my son as me being a single father.. | sorry like i said your right in someways..... i dont mean to sound stupid or lame but sometimes you have to just to get someware.... i know just because your a mod that does not mean that i have to take your power against you.. that is kool i have no problem with that and i know that your a good mod.. but sometimes things are diffrent... but thanx for your help.... 
|
|
|
11-03-2002, 11:33 AM
|
#8
|
Moderator
Registered: May 2001
Posts: 29,415
|
Np dude, that's what we're here for, just make sure you wget yourself that copy of the ABS, you'll find it very usefull...
|
|
|
All times are GMT -5. The time now is 01:46 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
|
|