- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script addition
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
02-24-2009 11:19 AM
02-24-2009 11:19 AM
If [[ $# != 1 ]]
then
echo â Test mode - Command would be: chown / chmodâ $FILENAME
else
perform chown/chmod
fi
But I am having trouble incorporating it into the script. Can someone help me with where to add this in, or know of an easier way?
Solved! Go to Solution.
- Tags:
- Test
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2009 11:29 AM
02-24-2009 11:29 AM
Re: Script addition
#!/usr/bin/sh
if [ $# -ne 1 ]; then
echo "ONE argument only, please"
else
echo "OK, I saw one argument"
fi
...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2009 11:33 AM
02-24-2009 11:33 AM
Re: Script addition
#!/usr/bin/sh
if [ $# -ne 1 ]; then
echo "ONE argument only, please"
exit 99
else
echo "OK, I saw one argument"
fi
...
If not using one and only one argument, get the heck out of Dodge. :-)
HP-Server-Literate since 1979
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2009 11:44 AM
02-24-2009 11:44 AM
Re: Script addition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2009 11:48 AM
02-24-2009 11:48 AM
Re: Script addition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2009 11:53 AM
02-24-2009 11:53 AM
Re: Script addition
...
echo "TEST MODE - command would be: 'chown somebody ${FILENAME}'"
...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2009 12:05 PM
02-24-2009 12:05 PM
Re: Script addition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2009 12:46 PM
02-24-2009 12:46 PM
Re: Script addition
Please attach a TEXT file.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2009 01:08 PM
02-24-2009 01:08 PM
Re: Script addition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2009 01:09 PM
02-24-2009 01:09 PM
Re: Script addition
- Tags:
- missing attachment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2009 01:23 PM
02-24-2009 01:23 PM
SolutionOK, let's rewrite this now that I see (I think) where you are going and now that I have a text file that I can open and read :-)
# cat /.fixup
#!/usr/bin/sh
typeset CMD=""
[ "$1" = "-d" ] && CMD=echo
awk -F":" '$3>100 {print $3,$4,$6}' /etc/passwd | \
while read UID GID DIR X
do
for FILE in .profile .Xauthority .elm .forward .neditdb .sh_history \
.ssh2 .sw .exrc .cshrc .login .logout .env .dt
do
${CMD} chown ${UID}:$GID ${DIR}/${FILE}
${CMD} chmod 740 ${DIR}/${FILE}
done
done
exit
...run as:
# ./fixup -d
...to debug; otherwise to actually perform the work, run as:
# ./fixup
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2009 01:32 PM
02-24-2009 01:32 PM
Re: Script addition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2009 01:34 PM
02-24-2009 01:34 PM
Re: Script addition
> Ok so I can run it with a -d to "test" it and without the -d to actually perform the work. Correct?
Yes.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2009 05:54 AM
02-25-2009 05:54 AM
Re: Script addition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2009 06:06 AM
02-25-2009 06:06 AM
Re: Script addition
Looking again at your objective, I see two things you need to reconsider:
1. Some of the objets inyour list are directories; eg. ".sw". Making the permissions on a directory = 740 means that the group can't search the directory and you might as well make the permissions = 700 since group members are crippled.
2. If you objective is to change all of the contents of the HOME directories you find, then a _recursive_ chown() and a _recursive_ chmod() might be useful. See the manpages.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2009 08:06 AM
02-25-2009 08:06 AM
Re: Script addition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2009 08:16 AM
02-25-2009 08:16 AM