GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- please help interpret script
Operating System - HP-UX
1847211
Members
2286
Online
110263
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
08-11-2002 01:14 AM
08-11-2002 01:14 AM
please help interpret script
Hi,
I have the script attached which I found from some website. It does not have documentation on it and the comments are not very helpful.
It's basically suppose to rsync a group of filesystems from 1 host machine onto another host machine having the same filesytem structure.
Can someone please help me interpret the portions in the script which have comments in uppercases?
Thanks.
I have the script attached which I found from some website. It does not have documentation on it and the comments are not very helpful.
It's basically suppose to rsync a group of filesystems from 1 host machine onto another host machine having the same filesytem structure.
Can someone please help me interpret the portions in the script which have comments in uppercases?
Thanks.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2002 09:59 AM
08-11-2002 09:59 AM
Re: please help interpret script
Hi,
the part you marked is only about options. That loop is entered if and only if the script was started with command-line parameters - some of them might be options, some might be data.
"getopt" is a useful function to parse the command-line (i.e. $* are the words of the command-line following your script's name) for options (i.e. starting with a "-" = minus).
The only options that script is interested in are the single-character options "d", and "h", and "n".
If one is found, a shell-variable is set appropriately and then it is deleted from the parameter-list (upon "-h" the script exits, of course).
As an example take the command-line like this:
script -d -n aaa bbb ccc
Then that loop turns it into:
script aaa bbb ccc
but now the shell-variables $RSYNC_DEBUG and $RSYNC_DRY_RUN are set (they were empty before).
So the rest of your script can use "$*" without having to care about options any more.
HTH,
Wodisch
the part you marked is only about options. That loop is entered if and only if the script was started with command-line parameters - some of them might be options, some might be data.
"getopt" is a useful function to parse the command-line (i.e. $* are the words of the command-line following your script's name) for options (i.e. starting with a "-" = minus).
The only options that script is interested in are the single-character options "d", and "h", and "n".
If one is found, a shell-variable is set appropriately and then it is deleted from the parameter-list (upon "-h" the script exits, of course).
As an example take the command-line like this:
script -d -n aaa bbb ccc
Then that loop turns it into:
script aaa bbb ccc
but now the shell-variables $RSYNC_DEBUG and $RSYNC_DRY_RUN are set (they were empty before).
So the rest of your script can use "$*" without having to care about options any more.
HTH,
Wodisch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2002 04:00 PM
08-11-2002 04:00 PM
Re: please help interpret script
Wodish,
Thanks for the reply. I was wondering if you help interpret the block of code below, taken from the script.
I do not quite understand the statement about the combination of grep and sed.
### NEED HELP HERE TILL THE END !!!!! ################
my_exclude_options=`cat $RSYNC_DATA_DIR/$EXCLUDE_FILE|grep -v '^'#|grep $dirs|sed "s/^archive\/$dirs\///g"`
# If we want to use the switch "--exclude-from="
my_exclude_file="/var/tmp/${dirs}_excluded_file"
if [ -f $my_exclude_file -o -d $my_exclude_file ]; then
/bin/rm -fr $my_exclude_file
fi
touch $my_exclude_file
for file in $my_exclude_options
do
echo $file >> $my_exclude_file
done
EXCLUDE_OPTIONS="--exclude-from=$my_exclude_file"
Thanks.
Thanks for the reply. I was wondering if you help interpret the block of code below, taken from the script.
I do not quite understand the statement about the combination of grep and sed.
### NEED HELP HERE TILL THE END !!!!! ################
my_exclude_options=`cat $RSYNC_DATA_DIR/$EXCLUDE_FILE|grep -v '^'#|grep $dirs|sed "s/^archive\/$dirs\///g"`
# If we want to use the switch "--exclude-from="
my_exclude_file="/var/tmp/${dirs}_excluded_file"
if [ -f $my_exclude_file -o -d $my_exclude_file ]; then
/bin/rm -fr $my_exclude_file
fi
touch $my_exclude_file
for file in $my_exclude_options
do
echo $file >> $my_exclude_file
done
EXCLUDE_OPTIONS="--exclude-from=$my_exclude_file"
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2002 11:41 PM
08-11-2002 11:41 PM
Re: please help interpret script
Hi
The line :-
my_exclude_options=`cat $RSYNC_DATA_DIR/$EXCLUDE_FILE|grep -v '^'#|grep $dirs|sed "s/^archive\/$dirs\///g"`
The grep -v is excluding ('^'#|) see man grep and the attached will help with sed.
Paula
The line :-
my_exclude_options=`cat $RSYNC_DATA_DIR/$EXCLUDE_FILE|grep -v '^'#|grep $dirs|sed "s/^archive\/$dirs\///g"`
The grep -v is excluding ('^'#|) see man grep and the attached will help with sed.
Paula
If you can spell SysAdmin then you is one - anon
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP