- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: call script file in .profile
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2011 11:38 AM
10-12-2011 11:38 AM
I have this script in each users's profile that I don't want to login with more than one session.
after the script i run a program with another exit command at the end. the problem is when i try to call a file that has this script, the exit command doesn't logout the user it just echo's the "...already logged in" text and then runs the other program.
# Check if the user is logged in #
telsession=$(who | grep $LOGNAME | wc -l)
if [ ${telsession} -ge 2 ]
then
clear
echo "You are already logged in"
exit
fi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2011 11:57 AM - edited 10-12-2011 01:34 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2011 12:18 PM
10-12-2011 12:18 PM
Re: call script file in .profile
how do you source it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2011 01:07 PM
10-12-2011 01:07 PM
Re: call script file in .profile
@Amir Haboosheh wrote:how do you source it?
"Sourcing" is done in the Korn, POSIX (which is the so-called HP-UX shell), and the bash shell with a dot-charater, followed by whitespace, followed by the name of the file to be sourced:
. file_to_source
The Bash shell can also use the keyword 'source' in leu of the dot.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2011 01:26 PM
10-12-2011 01:26 PM
Re: call script file in .profile
thank you both. the source command didn't work but the "." did
thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2011 01:33 PM - edited 10-12-2011 01:38 PM
10-12-2011 01:33 PM - edited 10-12-2011 01:38 PM
Re: call script file in .profile
>the source command didn't work but the "." did
Of course, you are using a real shell, not bash nor the scummy C shell.