04-02-2002
Help, boys: How to 'unset noglob' in a SCRIPT? Help!
Hi, I am stuck.. need help
I am writing a script that takes arguments. first check if the arguments contain wildcard (?,*) . if it contains , list it. if it doesn't contains, do something else (eg. cp it)
the problem is:
when i type
> script1 a*
the $@ contain : a, ab, aaa, abcd .....
and $1 is a, $2 is ab, $3 is aaa....
there is no such a variable is actually "a*" for me to check!!
I can turn off the 'noglob' by typing > set -o noglob
but, i can't do it IN A SCRIPT.
what other ways i can do this?
Help!
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I'm trying to figure out how to build a small shell script that will find old .shtml files in every /tgp/ directory on the server and delete them if they are older than 10 days...
The structure of the paths are like this:
/home/domains/www.domain2.com/tgp/
/home/domains/www.domain3.com/tgp/... (1 Reply)
Discussion started by: Neko
1 Replies
2. Shell Programming and Scripting
How do I check if the argument passed to a script is an integer?
I am writting a script that will take to integers and want to be able to check before I go on.
I am using bourne shell.
Thanks in advance (13 Replies)
Discussion started by: elchalateco
13 Replies
3. Shell Programming and Scripting
Hi all,
Can you please suggest a few lines of if statement to check if a variable is an ip address purely in bash/sh?
Thanks,
Marc (3 Replies)
Discussion started by: marcpascual
3 Replies
4. UNIX for Dummies Questions & Answers
I have a script that when called can have 1 or 2 command arguments. If only 1 command argument is passed into the script how can I check that the second argument is null? I am working in Korn shell in a UNIX environment.
Example of script call with 2 arguments:
% statreport 0300 1430
... (6 Replies)
Discussion started by: Nysif Steve
6 Replies
5. UNIX for Advanced & Expert Users
Hi
I allow the user tommy to run this command as root
sudoCommand: /app/appname/connectors/*/*/current/bin/*With "sudo -l" he sees the sudoers, but is unable to execute.
$ sudo /app/appname/connectors/zur/namename/current/bin/othername agentsvc --i --u root --sn 1m7command
Sorry, user... (2 Replies)
Discussion started by: slashdotweenie
2 Replies
6. Shell Programming and Scripting
Hi
I would like to know how I can check whether there is one or more folders in the current directory which begins with e.g. 2011-11.
Initially I figured that this could easily be done simply by:
if ; then ...
However if there is more than one folder which begins with 2011-11 then it... (1 Reply)
Discussion started by: aknu
1 Replies
7. Shell Programming and Scripting
Hi guys,
I have created a csh script which allows user to pass input argument with the script like:
cluster_on_lev3.csh -t <value> -p <value>
Example:
cluster_on_lev3.csh -t 2.3 -p 0.05
Now I want to create an error code where if user passes input argument without spaces , the code... (16 Replies)
Discussion started by: dixits
16 Replies
8. Shell Programming and Scripting
I need a script that should print 'yes' if the argument is a valid shell variable name else 'No' if it is not a valid shell variable. A valid one begins with an alphabet or percentage (%) character and is followed by zero or more alphanumberic or percentage (%) characters.
For example:
$... (6 Replies)
Discussion started by: pingiliarjun
6 Replies
9. Shell Programming and Scripting
All,
I'm writing an argument checking block and running into an error. I want to confirm that $1 is one of two values. Here is what I have:
if ]; then
echo -e "\nPlease check your first augument. You used \"$1\"
which is not recognized. Please see usage:"
usage
... (9 Replies)
Discussion started by: hburnswell
9 Replies
10. Shell Programming and Scripting
Hi All,
I have to send some files as attachments to an email using mailx copmmand in a shell script.
The files will be generated by some other application everyday with names starting with the literal 'Send' followed by some random sequence of characters in the filenames.
I tried... (1 Reply)
Discussion started by: sagarparadkar
1 Replies