Sponsored Content
Top Forums Shell Programming and Scripting passing parameters to the script Post 302635909 by Scrutinizer on Sunday 6th of May 2012 03:43:07 PM
Old 05-06-2012
@tukuyomi:
Code:
$ cat test.sh
echo "\$# \"$#\""
echo "\$1 \"$1\""
echo "\$2 \"$2\""
if [ "$1" = '' ]; then 
  echo no arguments given
fi

$ ./test.sh
$# "0"
$1 ""
$2 ""
no arguments given

$ ./test.sh "" 2
$# "2"
$1 ""
$2 "2"
no arguments given

This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Passing parameters in script

I have 2 scripts: script1 and script2 Script1 passes 4 parameters to script2 as follows #script1 code ... ... script2 $var1 $var2 $var3 $var4 Script2 uses the export command to know to expect these values #script2 export $1 $2 $3 $4 code ... ... The problem that I am having is... (1 Reply)
Discussion started by: eliguy
1 Replies

2. Shell Programming and Scripting

passing parameters from a shell script to sqlplus

Hi , I want to pass parameters from a shell script to a sql script and use the parameter in the sql query ..and then I want to spool a particular select query on to my unix box... for 4 different locations by writing only one sql script Right now no file is generated on the unix box...it is a... (2 Replies)
Discussion started by: phani
2 Replies

3. Programming

Passing Parameters and getting values back from a c program to Shell script

I am having a shell script which has to be called from a C program. I have to pass two parameters to this script. HOw can I do that? eg: int main() { char st1; char str2; // call a shell script call_sh(str1,str2) where call_sh is the name of the shell script. then i need to get the return... (5 Replies)
Discussion started by: Rajeshsu
5 Replies

4. Shell Programming and Scripting

Random parameters passing in FTP script

Hi I have a question. In the FTP script if we are passing all the required value like Hostname, username, password, Action(put or get), Filename, & mode(ascii or binary) through parameters then we have to pass these in the exact orders in which they are taken like if we defined Username=$2... (2 Replies)
Discussion started by: sourabhshakya
2 Replies

5. Shell Programming and Scripting

Passing parameters to Shell script for GREP command

I am using grep to capture date from a file . Since i need to use the shell script for different dates ,is it possible to pass the date parameter to the shell script the Script is as below grep -E "08 Aug 2008|2008-08-08"* somefile.txt>test.txt The above script file greps the... (1 Reply)
Discussion started by: sud.tech
1 Replies

6. Shell Programming and Scripting

Shell Script Passing Parameters For Directory Listing

i have this basic piece of code that i am trying to debug to accept input parameter to be able to display a directory listing of files. cd /u02/app/eatv/dev/out CURDIR=`pwd` echo directory listing of $CURDIR echo if ; then ls -latr else ls -latr $1 fi basically if the script... (9 Replies)
Discussion started by: wtolentino
9 Replies

7. Shell Programming and Scripting

passing parameters from a script to a datastage job

We have a requirement as follows. We have created a datastage job that will be doing the select operation from table (select query from a table). The datastage job is being invoked by a unix shell script(ksh). We are passing the "table name (STUD_DETAILS)" and a "where clause condition... (4 Replies)
Discussion started by: kmanivan82
4 Replies

8. Shell Programming and Scripting

Passing parameters to bash script function (or subroutine)

I've found a few posts regarding passing parameters to a function or subroutine, but for some reason when I try to run a command based on part with these parameters it's not working. If I have the function echo the parameters they show correctly so I believe they are being passed right but the... (2 Replies)
Discussion started by: withanh
2 Replies

9. Shell Programming and Scripting

Shell Script passing parameters to sqlplus code

Hello All, I am interested in finding out a way to pass parameters that are entered at the prompt from HP unix and passed to SQLPlus code with a Shell Script. Is this possible? Thanks (4 Replies)
Discussion started by: compprog11
4 Replies

10. Shell Programming and Scripting

Passing command line parameters into script

Not a good post. (1 Reply)
Discussion started by: bash_in_my_head
1 Replies
FAXSETUP(8)						      System Manager's Manual						       FAXSETUP(8)

NAME
faxsetup - setup a machine for use with HylaFAX SYNOPSIS
/usr/sbin/faxsetup [ -client ] [ -server ] [ -with-VAR[=value] ] DESCRIPTION
faxsetup is an interactive shell script that does the necessary setup work to configure a client or server machine for the HylaFAX soft- ware. faxsetup must be run on every HylaFAX server machine before the software will function-if a HylaFAX server program or script is invoked before faxsetup is run, the command will abort with a message that says to run faxsetup. faxsetup may optionally be run on a HylaFAX client machine to verify the configuration of the software. By default faxsetup checks a machine for use both as a HylaFAX client and server. Client-specific checks include: o the installation of client programs and data, o the installation of the Adobe Font Metric (AFM) information files used by the HylaFAX text formatting support. Server-specific checks include: o the installation of server programs and data, o the existence of the UUCP lock file directory, o the installation of the TIFF software tools, o the configuration of the getty programs invoked for data and voice calls, o the pathnames for various system programs used by server shell scripts, o proper support for FIFO special files, o proper installation of a POSTSCRIPT RIP, o definition of a ``fax'' user, o definitions for the ``hylafax'' and ``snpp'' services, o startup of the HylaFAX server processes: faxq(8) and hfaxd(8), o definition of a ``FaxMaster'' mail alias for reporting server problems. For server machines faxsetup also creates two files that are required by the HylaFAX command scripts. One file contains master configura- tion parameters and the other contains various definitions used by scripts such as faxaddmodem(8) that communicate with modems. OPTIONS
-client Do client-specific consistency checks. -server Do server-specific consistency checks. -with-VAR[=value] Override the default definition for the configuration parameter named VAR; optionally specifying a new value (if no value is specified then ``yes'' is used). This option is especially useful to override the default settings for the POSTSCRIPT inter- preter package to use (e.g. ``-with-PS=dps''), the spooling directory (``-with-DIR_SPOOL=/mumble''), the directory where the tool applications of TIFF software distribution are located (``-with-TIFFBIN=/usr/freeware''), etc. A complete list of the possible parameters can be found by looking at the contents of the faxsetup shell script; many of these configuration parameters are also described in the online documentation -help Print a help message and terminate. -quiet Do not print verbose messages to the terminal. -verbose Print informative messages to the terminal (default). BUGS
faxsetup does not query a modem to find out its capabilities when invoking the faxmodem program to setup a server in a send-only configura- tion; it may be necessary to run faxmodem manually. FILES
/var/spool/hylafax/etc/setup.cache master configuration parameters /var/spool/hylafax/etc/setup.modem modem-related configuration support Consult hylafax-server(5) for a complete discussion of the structure and content of the spooling area. SEE ALSO
hylafax-server(5), hylafax-config(5), faxq(8), faxgetty(8), faxmodem(8), faxconfig(8), faxsend(8) August 26, 1996 FAXSETUP(8)
All times are GMT -4. The time now is 01:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy