10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
here is my script that expects the user to run it like
./best.sh -f /tmp/log.txt
more best.sh
#!/bin/bash
while getopts ":f:" opt; do
case $opt in
f) file_in="$OPTARG"
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
done uname -a
SunOS mymac 5.11 11.2 sun4v... (15 Replies)
Discussion started by: mohtashims
15 Replies
2. UNIX for Advanced & Expert Users
Hello Gurus :)
I'm "currently" (for the last ~2weeks) writing a script to build ffmpeg with some features from scratch.
This said, there are quite a few features, libs, to be downloaded, compiled and installed, so figured, writing functions for some default tasks might help.
Specialy since... (3 Replies)
Discussion started by: sea
3 Replies
3. Shell Programming and Scripting
EDIT: -- SOLVED --
Heyas,
Getting used to optargs, but by far not understanding it.
So i have that script that shall be 'changeable', trying to use the passed arguments to modify the script visuals.
Passing:
browser -t test -d sect $HOME
Where -t should change the title,
and -d... (0 Replies)
Discussion started by: sea
0 Replies
4. Shell Programming and Scripting
Heyas
Just recently there was a thread about parsing arguments, where i read the first time about getopts.
This said, i'd like to 'provide' a list function that can be 'trigered' using an 'option'(?).
The regarding code snippets are:
while getopts... (7 Replies)
Discussion started by: sea
7 Replies
5. Shell Programming and Scripting
I'm using getopts to process command line args in a Bash script. The code looks like this:
while getopts ":cfmvhs:t:" option; do
case $option in
c) operationMode="CHECK"
;;
f) operationMode="FAST"
;;
m) ... (6 Replies)
Discussion started by: gencon
6 Replies
6. Shell Programming and Scripting
i have the following scenario want to run the following script with manadory and optional argumnets
Manadory options are :
filename=""
port=""
optional arguments
type -t
balances -b bal
prices -p
./test filename port -t A -b bal
my code i have that won't parse the options is... (1 Reply)
Discussion started by: nano2
1 Replies
7. Shell Programming and Scripting
Hello All,
I have shell script as below in a.ksh.
#! /usr/bin/ksh
while getopts a: b: ab:f: VAR
do
case $VAR in
a) A=${OPTARG}
echo $A;;
b) B=${OPTARG}
echo $B;;
ab) AB=${OPTARG}
echo $AB ;;
f) F=${OPTARG}
echo $F ;;
esac
done
When I execute sh a.ksh -a 1 -b 2 -ab 3 -f 4 as below... (7 Replies)
Discussion started by: tonsat
7 Replies
8. Shell Programming and Scripting
Hi,
Unexpectedly, the function below doesn't seem to work
when called a second time. The output shows that when
the function is called the first time, it works as expected
but when it is called a second time, the loop that processes
the options passed to the function, with the while loop,... (2 Replies)
Discussion started by: ASGR
2 Replies
9. UNIX for Dummies Questions & Answers
Hi, I'm having problems with a script where I wanted every single option specified in the command line to have an argument taken with it, but for some reason only d works in the code I will be showing below.
For example if I did ./thisfile -a something
it would come up with "a chosen with " as... (2 Replies)
Discussion started by: IceX
2 Replies
10. Shell Programming and Scripting
I need to create a shell script having the menu with few options such as
1. Listing 2. Change permissions 3. Modify Contents 4. Delete Files 5. Exit
1. For 1. Listing: Display a special listing of files showing their date of modification and access time (side by side) along with their... (2 Replies)
Discussion started by: bab123
2 Replies