[BASH] Getopts/shift within a function, unexpected behaviour
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 this is quite a task to achieve, one want to have it reproducable, right?
Also, i wanted to have seperate log files for each lib, instead of everything on the screen.
So i've put that handling into those functions.
Anyway, the issue is, that on some occasions the functions get 2 args, but shifts one eventhough it should not. (to my understand at least)
So my main question is:
Why does the first variable of the 'faac default-download' become deleted/shifted?
Code segment:
The first blocks are just to compare. Functions (related): Outputs:
Obviously aborted the build, since it will fail with the URL as (temp-)file name and missing the very same URL mainwhile...
I wrote a script that uses getopts and it works fine. However, I would like to put the function in that script in a startup file (.kshrc or .profile). I took the "main" portion of the script and made it a function in the startup script. I source the startup script but it doesn't seem to parse... (4 Replies)
Hi, I'm trying to create a script that will display the contents of the users directories, but i'm confused about how to incorporate the shift properly.
The problem I'm getting with my script is that it goes throught the first couple of directories but then returns an error as it loses the... (10 Replies)
If I call my function with grouped options: "logm -TDIWEFO 'message' ", then only the "T" gets parsed correctly. The subsequent values returned have underscores prefixed to the value: "_D", "_I", etc. If I "logm -T -DIWEFO 'message' ", the "T" and the "D" are OK, but "I" through "O" get the... (2 Replies)
Hello,
We have a system running AIX 6.1.7.1. We have created a Workload Partition(wpar) on this system with wpar specific routing enabled.
On wpar, we are running DNS (UDP/53) and syslog (UDP/514).
en0: 1.1.1.1/255.255.255.0 NOT assigned to any wpar
en1:... (0 Replies)
Hi All
I have searches getopts function in Perl a lot, but yet i didn't cleared with it.
First I want to know what is the meaning of
getopts('t:c:', \%options);
and please explain getopts function in an easy way.. (4 Replies)
How can I say one of the options is required? can I use an if statement?
let say:
while getopts ":c:u:fp" opt; do
case $opt in
c) echo "-c was triggered, Parameter: $OPTARG" >&2;;
u) echo "-u was triggered, Parameter: $OPTARG" >&2;;
f) echo "-u was triggered,... (2 Replies)
Hi All,
My requirement is to remove the more than 60 days files from Archive folder, so prepared this command.
for files in `find /abc/Archive/<file_name_25032012.dat> -type f -mtime 61|xargs ls -lrt`
do
rm -f $files
done
I tested this command in both unix and informatica.
In unix if files... (8 Replies)
Hi!
I recently downloaded a wordlist file called 2of12.txt, which is a wordlist of common words, part of the 12dicts package. I've been getting unexpected results from grepping it, such as getting no matches when clearly there ought to be, or returns that are simply wrong.
Par exemple:
egrep... (4 Replies)
Hi All,
I am using geopts inside a function in shell script.
But it is doesnt seem to read the input args and I always gt empty value in o/p.
my code is
http://sparshmail.ad.infosys.com/owa/14.2.318.4/themes/base/pgrs-sm.gif
This message has not been sent.
#!/bin/ksh IFS=' '... (1 Reply)
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)