- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Ch. 11 Shell Script Needed
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
Forums
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
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
05-26-2004 02:33 AM
05-26-2004 02:33 AM
Previously all users were using the Bourne shell. The administration has changed the policy and now everyone is asked to use the POSIX shell. Write a program that changes the shell of all users from /usr/bin/old/sh to /usr/bin/sh.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2004 02:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2004 02:55 AM
05-26-2004 02:55 AM
Re: Ch. 11 Shell Script Needed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2004 03:03 AM
05-26-2004 03:03 AM
Re: Ch. 11 Shell Script Needed
If I understand you, you need a routing that replace in the passwd file the string â /usr/bin/old/shâ to â /usr/bin/shâ . Try whit this one:
for i in `cat /etc/passwd`
do
echo $i | awk '{ sub("/usr/bin/old/sh","usr/bin/sh"); print $0 }' >> /tmp/newpasswd
done
this routing dosenâ t work if the lines in the file has bl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2004 03:05 AM
05-26-2004 03:05 AM
Re: Ch. 11 Shell Script Needed
I agree with Mark only one more addition:
sed "s/\/usr\/bin\/old\/sh$/\/usr\/bin\/sh/" /etc/passwd > /etc/passwd.new && mv /etc/passwd.new /etc/passwd
add the "$" after the \/usr\/bin\/old\/sh$ to make sure that only the last item of each entry is changed.
manish.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2004 03:09 AM
05-26-2004 03:09 AM
Re: Ch. 11 Shell Script Needed
do
/usr/sbin/usermod -s /usr/bin/sh $i
done
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2004 03:11 AM
05-26-2004 03:11 AM
Re: Ch. 11 Shell Script Needed
cp /etc/passwd /etc/passwd.bak
for i in `cut -d : -f1 /etc/passwd`
do
/usr/sbin/usermod -s /usr/bin/sh $i
done
Anil