03-27-2002
how to check if the argument contain wildcard (*,?) ?
In a script , i would like to check if the argument ( $1, $2 inside the script) contain wildcard (*,? etc). how do i do it?
> script_name arg1 arg*
$1 (arg1) does not contain wildcard, but $2 (arg* )contains wildcard. how can i tell in script?
i need to do this is because :
if arg1 (not contain *,? ) do ...
else (contain *,?...) do ....
clear?
thks
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
LEARN ABOUT ULTRIX
environ
execl(3) Library Functions Manual execl(3)
Name
execl, execv, execle, execlp, execvp, exect, environ - execute a file
Syntax
execl(name, arg0, arg1, ..., argn, (char *)0)
char *name, *arg0, *arg1, ..., *argn;
execv(name, argv)
char *name, *argv[];
execle(name, arg0, arg1, ..., argn, (char *)0, envp)
char *name, *arg0, *arg1, ..., *argn, *envp[];
execlp(file, arg0, arg1, ..., argn, (char *)0)
char *file, *arg0, *arg1, ..., *argn;
execvp(file,argv)
char *file, *argv[];
exect(name, argv, envp)
char *name, *argv[], *envp[];
extern char **environ;
Description
These routines provide various interfaces to the system call. Refer to for a description of their properties; only brief descriptions are
provided here.
In all their forms, these calls overlay the calling process with the named file, then transfer to the entry point of the core image of the
file. There can be no return from a successful exec. The calling core image is lost.
The name argument is a pointer to the name of the file to be executed. The pointers arg[0], arg[1] ... address null-terminated strings.
Conventionally arg[0] is the name of the file.
Two interfaces are available. is useful when a known file with known arguments is being called; the arguments to are the character strings
constituting the file and the arguments; the first argument is conventionally the same as the file name (or its last component). A 0 argu-
ment must end the argument list.
The version is useful when the number of arguments is unknown in advance. The arguments to are the name of the file to be executed and a
vector of strings containing the arguments. The last argument string must be followed by a 0 pointer.
The version is used when the executed file is to be manipulated with The program is forced to single step a single instruction giving the
parent an opportunity to manipulate its state. On VAX-11 machines, this is done by setting the trace bit in the process status longword.
When a C program is executed, it is called as follows:
main(argc, argv, envp)
int argc;
char **argv, **envp;
where argc is the argument count and argv is an array of character pointers to the arguments themselves. As indicated, argc is convention-
ally at least one and the first member of the array points to a string containing the name of the file.
The argv is directly usable in another because argv[argc] is 0.
The envp is a pointer to an array of strings that constitute the environment of the process. Each string consists of a name, an "=", and a
null-terminated value. The array of pointers is terminated by a null pointer. The shell passes an environment entry for each global shell
variable defined when the program is called. See for some conventionally used names. The C run-time start-off routine places a copy of
envp in the global cell which is used by and to pass the environment to any subprograms executed by the current program.
The and routines are called with the same arguments as and but duplicate the shell's actions in searching for an executable file in a list
of directories. The directory list is obtained from the environment.
Restrictions
If is called to execute a file that turns out to be a shell command file, and if it is impossible to execute the shell, the values of
argv[0] and argv[-1] will be modified before return.
Diagnostics
If the file cannot be found, if it is not executable, if it does not start with a valid magic number if maximum memory is exceeded, or if
the arguments require too much space, a return constitutes the diagnostic; the return value is -1. For further information, see Even for
the super-user, at least one of the execute-permission bits must be set for a file to be executed.
Files
/bin/sh Shell, invoked if command file found by execlp or execvp
See Also
csh(1), execve(2), fork(2), environ(7)
RISC execl(3)