Sponsored Content
Full Discussion: default shell for the user
Top Forums UNIX for Dummies Questions & Answers default shell for the user Post 302590275 by pandeesh on Sunday 15th of January 2012 12:09:09 PM
Old 01-15-2012
Thanks!
I have tried the below code for listing out all the shells:
Code:
#!/bin/bash
echo $SHELL
#!/bin/sh
echo $SHELL
#!/bin/csh
echo $SHELL
#!/bin/ksh
echo $SHELL
#!/bin/csh
echo $SHELL
#!/bin/zsh
echo $SHELL
#!/bin/ash
echo $SHELL

But i have got the result as:
Code:
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash
/bin/bash

After that i have understood that
Code:
echo $0

is giving the subshell.
So i have changed the script to:
Code:
#!/bin/bash
echo $0
#!/bin/sh
echo ${0}
#!/bin/csh
echo ${0}
#!/bin/ksh
echo ${0}
#!/bin/csh
echo $0
#!/bin/zsh
echo $0
#!/bin/ash
echo $0

But i am getting :
Code:
pandeeswaran@ubuntu:~$ ./shells_1
./shells_1
./shells_1
./shells_1
./shells_1
./shells_1
./shells_1
./shells_1

Please help me to achieve to list out the shells.

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

New z-shell user

Hi, I've just downloaded the following files and have been tinkering with using zsh on my NT box. Z-shell executable: ftp://ftp.blarg.net/users/amol/zsh/zsh.exe.gz Unix Utilities: http://homepage.mac.com/shadowboxer/unxutils.exe First impressions are good but I have 2 questions.... (0 Replies)
Discussion started by: Damian Ibbotson
0 Replies

2. Shell Programming and Scripting

How do i change to super user then revert back to ordinary user ,using shell script?

Hi all, I am trying to eject the cdrom from a livecd after certain stage... Now assuming that it is possible to eject,please consider my issue!!! The OS boots into a regular user by default...so i am unable to use the eject command to push out the drive... However if i try pfexec eject it... (3 Replies)
Discussion started by: wrapster
3 Replies

3. Virtualization and Cloud Computing

Cloud User Shell 1.0 (Default branch)

http://c.fsdn.com/fm/screenshots/70112_thumb.png Cloud User Shell (cush) is a multi-call executable bringing RESTful cloud control to the command line, combining many useful cloud computing utilities into a single executable. It follows the Unix philosophy of writing components that work together,... (0 Replies)
Discussion started by: Linux Bot
0 Replies

4. Shell Programming and Scripting

root user command in shell script execute as normal user

Hi All I have written one shell script for GPRS route add is given below named GPRSRouteSet.sh URL="www.google.com" VBURL="10.5.2.211" echo "Setting route for $URL for GPRS" URL_Address=`nslookup $URL|grep Address:|grep -v "#"|awk -F " " '{print $2}'|head -1` echo "Executing ... (3 Replies)
Discussion started by: mnmonu
3 Replies

5. UNIX for Dummies Questions & Answers

How to change Default Shell for any user?

Hi, I am new for solaris... how can we change default shell for any user and how to check that which shall currently we are in...... (1 Reply)
Discussion started by: lalit21984
1 Replies

6. UNIX for Dummies Questions & Answers

FTP user default shell defunct

Hello, I have a problem with my FTP users. I have create the ftp user on my AIX server, I set the default shell /bin/false or /usr/bin/false. Its enough that the user can logon via FTP. But when I try the user for example via ssh, the shell session is not killed, the session is defunct... (4 Replies)
Discussion started by: kalaso
4 Replies

7. Shell Programming and Scripting

How to Login as another user through Shell script from current user[Not Root]

Hi Every body, I would need a shell script program to login as different user and perform some copy commands in the script. example: Supppose ora_toms is the active user ora_toms should be able to run a script where user: ftptomsp pass: XXX should login through and run the commands ... (9 Replies)
Discussion started by: ujjwal27
9 Replies

8. Shell Programming and Scripting

Change default shell of a specific user with awk

I would like to replicate the functionality of chsh (or passwd -e) by awk. This is what I got so far, but I think there should be an easier way to search and replace field $7 only for lines beginning with user_name: awk -v user_name="$user_name" -v new_shell="$new_shell" -F: '$1 == user_name {... (2 Replies)
Discussion started by: nomad84
2 Replies

9. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

10. Shell Programming and Scripting

How to Switch from Local user to root user from a shell script?

Hi, I need to switch from local user to root user in a shell script. I need to make it automated so that it doesn't prompt for the root password. I heard the su command will do that work but it prompt for the password. and also can someone tell me whether su command spawns a new shell or... (1 Reply)
Discussion started by: Little
1 Replies
getusershell(3C)					   Standard C Library Functions 					  getusershell(3C)

NAME
getusershell, setusershell, endusershell - get legal user shells SYNOPSIS
#include <unistd.h> char *getusershell(void); void setusershell(void); void endusershell(void); DESCRIPTION
The getusershell() function returns a pointer to a legal user shell as defined by the system manager in the file /etc/shells. If /etc/shells does not exist, the following locations of the standard system shells are used in its place: /bin/bash /bin/csh /bin/jsh /bin/ksh /bin/ksh93 /bin/pfcsh /bin/pfksh /bin/pfsh /bin/sh /bin/tcsh /bin/zsh /sbin/jsh /sbin/pfsh /sbin/sh /usr/bin/bash /usr/bin/csh /usr/bin/jsh /usr/bin/ksh /usr/bin/ksh93 /usr/bin/pfcsh /usr/bin/pfksh /usr/bin/pfsh /usr/bin/sh /usr/bin/tcsh /usr/bin/zsh /usr/sfw/bin/zsh /usr/xpg4/bin/sh The getusershell() function opens the file /etc/shells, if it exists, and returns the next entry in the list of shells. The setusershell() function rewinds the file or the list. The endusershell() function closes the file, frees any memory used by getusershell() and setusershell(), and rewinds the file /etc/shells. RETURN VALUES
The getusershell() function returns a null pointer on EOF. BUGS
All information is contained in memory that may be freed with a call to endusershell(), so it must be copied if it is to be saved. NOTES
Restricted shells should not be listed in /etc/shells. SunOS 5.11 1 Nov 2007 getusershell(3C)
All times are GMT -4. The time now is 10:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy