Sponsored Content
Top Forums Shell Programming and Scripting check if argument is an ip address in bash/sh Post 302132449 by vino on Friday 17th of August 2007 02:54:26 AM
Old 08-17-2007
If you had searched the forum you would have found this post - IP address validation function
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

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... (3 Replies)
Discussion started by: gusla
3 Replies

2. Shell Programming and Scripting

Check if argument passed is an integers

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. UNIX for Dummies Questions & Answers

Check for Empty Command Argument

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

4. UNIX for Dummies Questions & Answers

Bash script argument problem

I'm having problems with bash scripts. If a bash script is called with no arguments, I always get "PHIST=!" as the first argument (i.e. this is what $1 equals). Why? Where does this come from, and how can I fix it? Nothing in the bash man pages refer to this mysterious default argument. (2 Replies)
Discussion started by: sszd
2 Replies

5. Shell Programming and Scripting

Using GET, passing argument to bash

Hi guys! So, I use GET ( Simple user agent using LWP library. ) on a remote text file that is then passed to bash and executed. However, I need to pass that bash script a single argument, and so far nothing that I have tried has worked, although I have learned quite a bit about input/output... (5 Replies)
Discussion started by: Rhije
5 Replies

6. Shell Programming and Scripting

How to use perl to run bash with argument?

Hi All, I want to run a bash script using perl. But they are in the different dir. #! /usr/bin/perl -w use strict; my $root=`pwd`; chomp($root); my $cmd=".$root/testdir/ft_623.sh 3 4 5 6 7"; print $cmd; my @line=`$cmd`; foreach (@line){ print $_; } ft_623.sh (0 Replies)
Discussion started by: Damon sine
0 Replies

7. Shell Programming and Scripting

Check for spaces in input argument!

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

Need a script to check if an argument is valid shell variable

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

Argument check

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. UNIX for Beginners Questions & Answers

Bash argument not expanding in script

I pass an argument to bash as run. The first command in green executes as expected, however the second in blue fails as the $run does not expand. I tried to escape the variable with \ thinking the quotes were making the literal translation and also "${run}" but both did not work to expand the... (3 Replies)
Discussion started by: cmccabe
3 Replies
RBASH(1)						      General Commands Manual							  RBASH(1)

NAME
rbash - restricted bash, see bash(1) RESTRICTED SHELL
If bash is started with the name rbash, or the -r option is supplied at invocation, the shell becomes restricted. A restricted shell is used to set up an environment more controlled than the standard shell. It behaves identically to bash with the exception that the follow- ing are disallowed or not performed: o changing directories with cd o setting or unsetting the values of SHELL, PATH, ENV, or BASH_ENV o specifying command names containing / o specifying a file name containing a / as an argument to the . builtin command o specifying a filename containing a slash as an argument to the -p option to the hash builtin command o importing function definitions from the shell environment at startup o parsing the value of SHELLOPTS from the shell environment at startup o redirecting output using the >, >|, <>, >&, &>, and >> redirection operators o using the exec builtin command to replace the shell with another command o adding or deleting builtin commands with the -f and -d options to the enable builtin command o using the enable builtin command to enable disabled shell builtins o specifying the -p option to the command builtin command o turning off restricted mode with set +r or set +o restricted. These restrictions are enforced after any startup files are read. When a command that is found to be a shell script is executed, rbash turns off any restrictions in the shell spawned to execute the script. SEE ALSO
bash(1) GNU Bash-4.0 2004 Apr 20 RBASH(1)
All times are GMT -4. The time now is 08:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy