10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hi,
Is there a special positional variables for when using the dot (.)?
Scripts are as below:
$: head -100 x.ksh /tmp/y.ksh
==> x.ksh <==
#!/bin/ksh
#
. /tmp/y.ksh 1234 abcd
echo "yvar1 = $yvar1"
echo "yvar2 = $yvar2"
==> /tmp/y.ksh <==
#!/bin/ksh (2 Replies)
Discussion started by: newbie_01
2 Replies
2. UNIX for Beginners Questions & Answers
Based on arguments passing in command prompt values should fetch and store in new file.
Sample:-
sh test.sh 10 30 35 45
cat test.sh
..
cut -c $1-$2,$3-$4 file_name >> file_new
...
...
Above sample passing 4 arguments.. but it may differ (sh test.sh 10 30 35 45 70 75 ) based on... (1 Reply)
Discussion started by: Jairaj
1 Replies
3. Shell Programming and Scripting
Hi Unix Gurus,
i am on learning path of unix, and yet to discover many things. I came across with this requirement where i need to pass parameters but the position of parameters is not fixed so after doing some google search got to know "getopts" can handle that. So here is my code:
function... (3 Replies)
Discussion started by: gnnsprapa
3 Replies
4. Shell Programming and Scripting
Here is my script:
#!/bin/ksh
usage ()
{
echo " Usage: $0 <opt1> <opt2> <opt3> <opt4>"
}
if ; then
usage
exit;
fi
prog -a $1 -b $2 -c $3 -d $4 2>&1 | tee -a ~/$1.log
I want argument 4 to be optional, so if there's no argument for opt4, that it doesn't... (8 Replies)
Discussion started by: guitarscn
8 Replies
5. Shell Programming and Scripting
I have an awk script which can be used in the following ways:
xi and xf will only be mandatory when processing the file fin.zc.
awk -v xi=0/-0.5 -v xf=80/30 -f ./zc2cmd.awk fin.zc > fout.cmod
awk -f ./zc2cmd.awk -u
awk -f ./zc2cmd.awk --usg
awk -f ./zc2cmd.awk -e
awk -f ./zc2cmd.awk... (1 Reply)
Discussion started by: kristinu
1 Replies
6. Shell Programming and Scripting
How to declare the two argument for optional switch ?
I have a script that search for a string in current or old zipped log file.
Im using a option something like this
${basename}
Since $1 can have only one argument should be passed when user select swicth -c and -o need to... (3 Replies)
Discussion started by: baraghun
3 Replies
7. Shell Programming and Scripting
Hi Experts,
There is a shell script that accepts positional parameter between 1-25 to execute case statement of script depending upon the parameter passed.
Now I need to run all the 25 sessions parallely. In each option of case statement it is connecting with sqlplus and executing a select... (11 Replies)
Discussion started by: Opamps123
11 Replies
8. Shell Programming and Scripting
Hi
I would like to use tar cmd in my script.
I have a variable with filenames, e.g. 1000 records and I would like to paste its values into tar cmd.
For this example I used three elements variable strings.
strings="file1.txt file2.txt file3.txt"
`tar cf file1.tar $strings`
Whether... (1 Reply)
Discussion started by: presul
1 Replies
9. Shell Programming and Scripting
Hi,
I am trying to call a function inside a shell script. Is there a way in which I can make the parameters options in the call?
Please help me with this.
Thanks!!! (2 Replies)
Discussion started by: neeto
2 Replies
10. Answers to Frequently Asked Questions
A good place to start is simple variable passing....
Passing variables from one script to another
The next level is passing a variable into a more complex command such as using a variable in a sed command. There are some simple quoting techniques that are very general. These are mentioned... (0 Replies)
Discussion started by: Perderabo
0 Replies