- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script help
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
09-28-2004 02:44 PM
09-28-2004 02:44 PM
I need help with a small loop script. In the loop below I need to set variable that will change the LUN number from 1 to 2 to 3 and so on and when the number reaches to 110 the script will exit.
What statement for variable I can use?
LUN= (what I can use here will change the number and stop the script when it goes to 110)
while true
do
armcfg -L $LUN -a 10G -g 1 va74xx
done
exit
If I can’t get the answer from the guru’s then I guess I am typing.
Thanks,
Mi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2004 03:19 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2004 03:39 PM
09-28-2004 03:39 PM
Re: Script help
I try to run this and I get following error.
Missing $ on loop variable at ./test.pl line 4.
Any idea.
Thanks,
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2004 03:42 PM
09-28-2004 03:42 PM
Re: Script help
while [ : ]
do
armcfg -L $i -a 10G -g 1 va74xx
i=`expr $i + 1`
if [ $i -gt 110 ]; then
break
fi
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2004 03:49 PM
09-28-2004 03:49 PM
Re: Script help
for a in `perl -e 'print "$i " while (++$i<10)'` ; do echo test $a test ; done
or with awk:
for a in `awk 'BEGIN {while (++i<10){ print i}}'` ; do echo test $a test ; done
Personally I prefer to stay in perl/awk and just generate and execute the command to be executed, or... just make them generate a file with the commands to execute, review, and execute the file:
perl -e 'print "armcfg -L $i -a 10G -g 1 va74xx" while (++$i<110)' > x
view x
chmod +x x
./x
Cheers,
hein.
`
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2004 03:59 PM
09-28-2004 03:59 PM
Re: Script help
LUN=1
while [[ $LUN -le 110 ]]
do
armcfg -L $LUN -a 10G -g 1 va74xx
let LUN=LUN+1
done
It will do this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2004 04:06 PM
09-28-2004 04:06 PM
Re: Script help
until [[ $i -gt 110 ]]; do
armcfg -L $i -a 10G -g 1 va74xx
let i=i+1
done
To use loop we have to go to awk programming only as,
echo "1 110" | awk '{
for (i=$1;i<=$2;i++) print $i system cmd to execute armcfg here.. }'
Use while / until to do easily more
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2004 05:37 AM
09-29-2004 05:37 AM
Re: Script help
Mike