![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Simple Scripting Problem | felixwhoals | Shell Programming and Scripting | 3 | 12-16-2007 01:24 PM |
| Simple Array in Ksh Scripting | ravikirankethe | UNIX for Dummies Questions & Answers | 2 | 11-01-2006 11:35 AM |
| HELP me PLS... Simple Scripting! | liezer | Shell Programming and Scripting | 2 | 09-14-2006 10:50 AM |
| simple scripting question | gennaro | Shell Programming and Scripting | 3 | 06-17-2005 03:49 AM |
| any tutorials on simple scripting? | xyyz | UNIX for Dummies Questions & Answers | 3 | 03-13-2003 01:31 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Help with simple scripting actions
Hi,
I am a beginner in unix shell scripting. I wanted simple information like 1- How to know what are the number of command line options given for the script file? 2- How to check if a variable value is interger or string? 3- How to use awk to replace value of a variable For example I have a file with 5 lines 1 2 ResourceID=ms1 3 4 ResourceID=ms2 5 How can I replace ms1 and ms2 values with other values using awk? Any site that can give me this information will also be very helpfull. Thanks! |
|
||||
|
Quote:
regarding Q1: if your shell supports getopts - I suggest you have a look at it (man getops). Otherwise you will need to write a small shell parsing code. (use $# shell variable that reports the amount of arguments passed to shell script). regarding Q2: I would use the following shell code: expr ${VALUE} + 1 2>/dev/null if [ $? -eq 0 ] then echo "Integer value" else echo "String value" fi cheers, Slava R. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|