Visit Our UNIX and Linux User Community

Use case for logout of shell

Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Use case for logout of shell
# 1  
Old 05-02-2018
Use case for logout of shell

Hello Experts,

I have a use case -

Currently, in my .profile I have added "bash" at the end so while logging in, it will be bashed as well. Which is working fine and no issues.

But while logging out, I have hit exit two times like 1st exit will come out of bash shell and 2nd exit will come out of the server.

So is there a way, that I can log out of the server with one exit from bash?
# 2  
Old 05-02-2018
Why the need at all to run bash from .profile? What's your login shell? Could you ask your sys admin to change your login shell to bash.
This User Gave Thanks to RudiC For This Post:
# 3  
Old 05-02-2018
If you can't get your admin to change your login shell, you should also just be able to change the last line in your .profile from something like:

to something like:
exec bash

Adding the exec will cause your login shell to be replaced by bash so you won't need to also quit your login shell after you quit bash.
These 3 Users Gave Thanks to Don Cragun For This Post:
# 4  
Old 05-24-2018
Originally Posted by Don Cragun
If you can't get your admin to change your login shell, you should also just be able to change the last line in your .profile from something like:

to something like:
exec bash

Adding the exec will cause your login shell to be replaced by bash so you won't need to also quit your login shell after you quit bash.
This is fantastic. It worked!

I was on vacation, so couldn`t respond on time.

Thank you so much.

---------- Post updated at 01:16 AM ---------- Previous update was at 01:13 AM ----------

Smiliesolution found. This can be closed.

some reason i am not seeing the tag option .
@ Admin , if you don`t mind , while you are closing , can you tag this with "solved"
# 5  
Old 05-24-2018
Moderator's Comments:
Mod Comment We don't usually manually close a thread unless there has been some serious violation of forum rules or a duplicated thread. Old threads are eventually closed automatically if the thread has not been updated in a while. If you need to reopen a closed thread, an administrator or moderator can do that for you.

At the top of each page of a thread, there is a section titled "Tags". At the top right side of that section there is a button titled "Edit Tags". If you hit that button, you can add, change, or remove tags. You can use that button to add the "solved" tag indicating that you have found a solution to the issue raised in the thread. (I have done that for you for this thread.)

If you found the suggestion(s) provided in one or more posts in a thread helpful to you, you can convey your thanks to the person who submitted that post by hitting the "Thanks" button at the bottom left corner of each post that helped you.
# 6  
Old 05-25-2018
why not chsh?

Previous Thread | Next Thread
Test Your Knowledge in Computers #362
Difficulty: Medium
The sed command first appears in Version 5 AT&T UNIX.
True or False?

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Linux Shell Scripting If-else and Case

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: This is what is asked: If the user enters ‘3’, prompt the user for two file names. Verify that the file names... (2 Replies)
Discussion started by: cindy01
2 Replies

2. Shell Programming and Scripting

Help with shell script 'CASE $'

Hi, I have a script that is called by /etc/init.d/S99oracle and the contents of this script are below. $ cat ../init.d/oracle ### BEGIN INIT INFO # Provides: oracle # Required-Start: $ALL # Required-Stop: # Default-Start: 3 5 # chkconfig: 35 99 10 # Default-Stop: # Description:... (7 Replies)
Discussion started by: welldone
7 Replies

3. Shell Programming and Scripting

shell script to run after ssh logout from another machine

Scenario: I currently manager a cluster at work which is on a private network and i constantly need to ssh to other clients for diags e.t.c. I created a debain client which i use as my gateway to get to all the clients on the private network and I then created a Shell menu script which will make... (4 Replies)
Discussion started by: defamer
4 Replies

4. UNIX for Advanced & Expert Users

Telnet from shell script , further need to logout if log in not authenticate

Using unix shell script file I need to telnet to a IP further send a command to the telnet IP and get the response to a file with out using "expect" utility and I have achieved this by below command. (sleep 3; echo admin; sleep 3; echo mypass; sleep 5;echo "show status-list"; sleep 5; echo... (3 Replies)
Discussion started by: raghunath Rao
3 Replies

5. Shell Programming and Scripting

Help with case (Shell: sh)

Help with case Hello I need some help with case since most of the examples I found are related to a choice menus I have 2 files (actually a lot of files with the specified prefix) in my dir e.g file1 & file2 I need to display: case1:if file1 & file2 exist :file1_no=$(ll file1 |wc -l);... (2 Replies)
Discussion started by: drbiloukos
2 Replies

6. Shell Programming and Scripting

[Solved] Change Upper case to Lower case in C shell

Is there a command that can switch a character variable from UPPER case to lower case? like foreach AC ( ABC BCD PLL QIO) set ac `COMMAND($AC)` ... end Thanks a lot! (3 Replies)
Discussion started by: rockytodd
3 Replies

7. Shell Programming and Scripting

Shell case statement

echo -e "Select: \c" read IN pattern="1-20" case $IN in ) echo "Selected: $IN" ;; *) echo "Invalid selection: $IN" ;; esac # sh test Select: 10 Invalid selection: 10 # sh test Select: 2 (6 Replies)
Discussion started by: Ikon
6 Replies

8. Shell Programming and Scripting

Any key press causing logout from shell

Hi all! I have written a shell script which will invoke perl script infinitly in the background in a loop. Code will do as:Within while loop, perl script will be run in background, get the pid and notify pid in though mail. then wait for pid to be completed before going for next iteration. I am... (1 Reply)
Discussion started by: jramesh1
1 Replies

9. Shell Programming and Scripting

Ignore Case in Shell

Hi New to this Unix dot com. I would like to know how i can ignore the case in filename which is getting as user directoty to shell script. For Ex: Source (/aa/bb/patch/) Directory may contains more than 1 files as like 1. aa.csv or Aa.csv or AA.csv or aa.CSV 2. bb.csv 3. ... (3 Replies)
Discussion started by: AAH
3 Replies

10. UNIX for Dummies Questions & Answers

lower case to upper case string conversion in shell script

How can convert a Lower case variable value to an upper case in the kron shell script. (3 Replies)
Discussion started by: dchalavadi
3 Replies

Featured Tech Videos