Passing variables/arguments/parameters to commands

Login or Register for Dates, Times and to Reply

Thread Tools Search this Thread
# 1  
Passing variables/arguments/parameters to commands

A good place to start is simple variable passing....
Passing variables from one script to another

The next level is passing a variable into a more complex command such as using a variable in a sed command. There are some simple quoting techniques that are very general. These are mentioned in...
How can I use a variable in sed?

Also awk has a couple of specific ways to handle this...
Passing values out awk.
PASS parameter to AWK
Passing argument to awk script

Doing this with aliases depends on your shell.....
Passing arguments to an alias
alias creation

Last edited by Perderabo; 06-28-2004 at 03:43 PM..
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Extract values based on parameters passing in arguments

Based on arguments passing in command prompt values should fetch and store in new file. Sample:- sh 10 30 35 45 cat .. cut -c $1-$2,$3-$4 file_name >> file_new ... ... Above sample passing 4 arguments.. but it may differ (sh 10 30 35 45 70 75 ) based on... (1 Reply)
Discussion started by: Jairaj
1 Replies

2. Programming

Passing printf formatting parameters as variables

Hi, I haven't programed in C in a few years. I have been doing a lot of shell scripting, I.E. not really programming anything heavy. :o That said, I have a script that gives hourly usage statistics for our email server. It runs w-a-y to slow as a script for my impatience, and needs to... (7 Replies)
Discussion started by: mph
7 Replies

3. Shell Programming and Scripting

Reading a string and passing passing arguments to a while loop

I have an for loop that reads the following file cat param.cfg val1:env1:opt1 val2:env2:opt2 val3:env3:opt3 val4:env4:opt4 . . The for loop extracts the each line of the file so that at any one point, the value of i is val1:env1:opt1 etc... I would like to extract each... (19 Replies)
Discussion started by: goddevil
19 Replies

4. UNIX for Dummies Questions & Answers

Passing arguments to alias with multiple commands

I have a few aliases set up on AIX servers in my .kshrc file. Some of them contain multiple commands that are piped together. A simple example would be something like this: # alias to list directory contents as root and sort by size. alias lss='sudo ls -l | sort -nbk5' When I call... (5 Replies)
Discussion started by: derndingle
5 Replies

5. UNIX for Dummies Questions & Answers

Passing arguments

I need to pass arguments to a shell script.My batch is calling some java program. ################# x=$1 y=$2 java -classpath program ################### if first parameter and second parameter is null then java -classpath program if first parameter is not null and second parameter is... (3 Replies)
Discussion started by: mnjx
3 Replies

6. Shell Programming and Scripting

Optional Parameters/arguments while executing a script.

Hello, I have a shell script "Test.ksh" and I need to pass 8 parameters/arguments while executing the script ./Test.ksh 1 2 3 4 5 6 7 8 Out of these I want first 3 to be compulsory and rest 5 to be optional. Can you suggest the way to do this like and also how to pass these optional... (3 Replies)
Discussion started by: indrajit_u
3 Replies

7. Shell Programming and Scripting

tar cmd how many arguments into parameters of filenames

Hi I would like to use tar cmd in my script. I have a variable with filenames, e.g. 1000 records and I would like to paste its values into tar cmd. For this example I used three elements variable strings. strings="file1.txt file2.txt file3.txt" `tar cf file1.tar $strings` Whether... (1 Reply)
Discussion started by: presul
1 Replies

8. Shell Programming and Scripting

passing arguments

Hi I have a script to which I pass multiple arguments, for example lets say the script name is "abc". I run the script like ./abc def /file <directory location> In the above "def" is the first argument and "/file" is the second argument. I expect <directory location> that is passed after... (4 Replies)
Discussion started by: zmfcat1
4 Replies

9. Shell Programming and Scripting

Passing Arguments-Help

Hi, I have a script which adds the user credentials to an ldap server. Im passing the variables as below.. /path/my_script $uname $pwd $environ ${deposit} If i enter some special characters like ';' in $pwd, script returns an error which is set to display if the user enters... (5 Replies)
Discussion started by: Tuxidow
5 Replies

10. Shell Programming and Scripting

passing more than 9 parameters

hi, i am passing around 14 parameters for a script a=$1 b=$2 c=$3 d=$4 e=$5 f=$6 g=$7 h=$8 i=\"${9}\" shift j=\"${1}\" still for j it is displaying the 1st parameter to make it take the 10th parameter (2 Replies)
Discussion started by: dnat
2 Replies
HOSTAPD_CLI(8)						    BSD System Manager's Manual 					    HOSTAPD_CLI(8)

hostapd_cli -- text-based frontend program for interacting with hostapd(8) SYNOPSIS
hostapd_cli [commands] DESCRIPTION
The hostapd_cli utility is a text-based frontend program for interacting with hostapd(8). It is used to query the current status. The hostapd_cli utility can show the current authentication status, dot11 and dot1x MIBs, etc. The hostapd_cli utility supports two modes: interactive and command line. Both modes share the same command set. Interactive mode is started when hostapd_cli is executed without any parameters on the command line. Commands are then entered from the con- trolling terminal in response to the hostapd_cli prompt. In command line mode, the same commands are entered as command line arguments. COMMANDS
The following commands may be supplied on the command line or at a prompt when operating interactively. mib Report MIB variables (dot1x, dot11) for the current interface. sta addr Report the MIB variables for the associated station with MAC address addr. all_sta Report the MIB variables for all associated stations. help Show usage help. interface [ifname] Show available interfaces and/or set the current interface when multiple are available. level debug_level Change the debugging level in hostapd(8). Larger numbers generate more messages. license Display the full license for hostapd_cli. quit Exit hostapd_cli. SEE ALSO
hostapd.conf(5), hostapd(8) HISTORY
The hostapd_cli utility first appeared in NetBSD 4.0. AUTHORS
The hostapd_cli utility was written by Jouni Malinen <>. This manual page is derived from the README file included in the hostapd distribution. BSD
June 16, 2005 BSD

Featured Tech Videos