12-17-2003
as you can see, the -s option gets a hostname from the command line. so the user would run the program like this:
./serverstatus -s hostname
then that information is parsed and, (in my example) nmap is run on that host and the output of that scan is stored in a variable.
each next command line option invokes a number of different functions which accomplish different tasks.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
What is the maximum no. of arguments that could be passed to a shell script ? Is there any restriction ?
I've a requirement where I need to pass a list of names to a unix script and I guess the number of such names is not a fixed one. It can run into hundreds.
Is this feasible ? (4 Replies)
Discussion started by: hidnana
4 Replies
2. Shell Programming and Scripting
Hi,
I have a shell script called ftp.sh which is running continously in background.
I tried passing arguments to this script but it did not worked out.
Below is ftp.sh script. Please help me
case $param in
start) sleep_func "300"
echo "!ksh $scr_ddir/ftp.sh... (1 Reply)
Discussion started by: bhargav20
1 Replies
3. Shell Programming and Scripting
Hi,
I have a function in shell script
fun1{ echo "No.of arguments are..."}
this function will be called in same script by passing arguments
fun 1 2 3
I want to check the no. of arguments passed to fun1 function in the same functionbefore validation.
can any one suggest me. (2 Replies)
Discussion started by: KiranKumarKarre
2 Replies
4. Shell Programming and Scripting
Here is my script:
#!/bin/ksh
usage ()
{
echo " Usage: $0 <opt1> <opt2> <opt3> <opt4>"
}
if ; then
usage
exit;
fi
prog -a $1 -b $2 -c $3 -d $4 2>&1 | tee -a ~/$1.log
I want argument 4 to be optional, so if there's no argument for opt4, that it doesn't... (8 Replies)
Discussion started by: guitarscn
8 Replies
5. Shell Programming and Scripting
Hello,
I have to make a shell script doing that :
the program tests if there is an argument, if there is it checks whether this is a directory or not, If it is it opens it.
for any .c file in the directory it prints 2 lines in the screen :
the dependence line of the .o and compiler commend... (1 Reply)
Discussion started by: dekl
1 Replies
6. Shell Programming and Scripting
Hi,
I have a shell script, when run it i get a prompt to enter arguments say 1 for doing my next task otherwise q for quit.
What I am trying to do is run the shell script with the argument passed in however it does not seem to work.
This is what I did
./test.sh 1
Instead it printed the line... (6 Replies)
Discussion started by: aqua9
6 Replies
7. Shell Programming and Scripting
I need to run a local shell script on a remote machine. I am able to achieve that by executing the command
> ssh -qtt user@host < test.sh
However, when I try to pass arguments to test.sh it fails.
Any pointers would be appreciated. (7 Replies)
Discussion started by: Sree10
7 Replies
8. Shell Programming and Scripting
My requirement is that I want to pass similar argument to a shell script and process it in the script. Something like below:
myScript.sh -c COMPONENT1 -c COMPONENT2 -a APPNote: -c option can be specified multiple times and -a is optional parameter
I know this can be achieved using... (2 Replies)
Discussion started by: rajdeep_paul
2 Replies
9. Shell Programming and Scripting
Hi all,
I am working on a project, in which I have to connect to Bluetooth low energy device. I am able to connect and do data transfer from command line. But I want to do from script
Here is my script
#!/bin/bash
#sudo hcitool -i hci0 lescan
sleep 1
sudo hcitool -i hci0 lecc --random... (8 Replies)
Discussion started by: nithin@embdes
8 Replies
10. Shell Programming and Scripting
Hello,
I have a simple shell script, which starts from crontab like this:
00 03 * * 2-6 /export/applications/dte/sh/fwmarg.sh > /export/applications/dte/data/cron_log/fwmarg.cronlog.`date +\%m.\%d` 2>&1
The script doesn't get any argument. But inside it I see the line
... (10 Replies)
Discussion started by: digioleg54
10 Replies
LEARN ABOUT OPENSOLARIS
hostconfig
hostconfig(1M) System Administration Commands hostconfig(1M)
NAME
hostconfig - configure a system's host parameters
SYNOPSIS
/usr/sbin/hostconfig -p protocol [-d] [ -h] [-n] [-v]
[-i interface] [-f hostname]
DESCRIPTION
The hostconfig program uses a network protocol to acquire a machine's host parameters and set these parameters on the system.
The program selects which protocol to use based on the argument to the required -p flag. Different protocols may set different host param-
eters. Currently, only one protocol (bootparams) is defined.
OPTIONS
The following options are supported:
-d Enable debug output.
-f hostname Run the protocol as if this machine were named hostname.
-h Echo the received hostname to stdout, rather than setting hostname using the system name directly.
-i interface Use only the named network interface to run the protocol.
-n Run the network protocol, but do not set the acquired parameters into the system.
-p protocol Run hostconfig using protocol. Currently, only one protocol (bootparams) is available. This option is required.
Specifying the -p bootparams option uses the whoami call of the RPC bootparams protocol. This sets the system's hostname,
domainname, and default IP router parameters.
-v Enable verbose output.
EXAMPLES
Example 1 Configuring Host Parameters with Verbose Output
The following command configures a machine's host parameters using the whoami call of the RPC bootparams protocol with a verbose output.
example# hostconfig -p bootparams -v
Example 2 Displaying Host Parameters
The following command displays the parameters that would be set using the whoami call of the RPC bootparams protocol.
example# hostconfig -p bootparams -n -v
Example 3 Configuring Host Parameters Less the System Name
The following command configures a machine's host parameters, less the system name, using the whoami call of the RPC bootparams protocol.
example# hostconfig='hostconfig -p bootparams -h'
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO
hostname(1), domainname(1M), route(1M), attributes(5)
SunOS 5.11 6 Nov 2000 hostconfig(1M)