Stumped .. is this a command line arg?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Stumped .. is this a command line arg?
# 1  
Old 11-05-2012
Question Stumped .. is this a command line arg?

I need a bit of explanation:

Code:
LogFile=${LOGS_DIR}/${1}_$$

I know:
- LOGS_DIR is an environment variable
- $$ is the PID
... but what is ${1} ?? Is it another method to access a command line variable, or the job name?

Thanks!
Jon
# 2  
Old 11-05-2012
$1 ${1} are the same thing. Any variable can be accessed witha leading $ or with ${ } to delimit the "edges" of the variable name

$1 is a command line variable.
# 3  
Old 11-05-2012
More specifically, $1 refers to the first argument.

For e.g., in $ ./test.sh abc xyz, $1 is abc, $2 is xyz
# 4  
Old 11-06-2012
{} in ${1} is not needed . its required only when you are calling arguments which are more than 1 digit . i.e. starting arg number 10 like ${10} and so on.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pass command line arg to sql file

Hi all, How to pass the command line argument to a sql file Script: #!/bin/ksh if ] ; then test.sql fi My Sql Informix DB: echo "select * from table where col1 = 2234 and col2 = '$3'"|dbaccess ddname But im getting `:' unexpected error (5 Replies)
Discussion started by: Roozo
5 Replies

2. Shell Programming and Scripting

Command not found in shell script - stumped for 4 days

Hello, I like to begin with :wall:.. literally... It has been 4 days and I have no idea how to fix it. Environment - AIX 5.3 I wrote a script to call on ssh to log into another box via PKA to do something else. If I run the script on the terminal, it works 100%. If the SAP customised... (11 Replies)
Discussion started by: plonkagain
11 Replies

3. Shell Programming and Scripting

ls command - strange error - arg list too long

I am running a shell script which has the following command ls *.pdf | wc -l error: arg list too long Please post your thoughts on this.. (4 Replies)
Discussion started by: techmoris
4 Replies

4. Programming

warning: int format,pid_t arg (arg 2)

I try following code under Solaris10,like follows: int glob = 6; int main(void) { int var; pid_t pid; var = 88; printf("before vfork\n"); if ((pid = vfork()) < 0) { err_sys("vfork error"); } else if (pid == 0) { glob++; var++; _exit(0); } ... (1 Reply)
Discussion started by: konvalo
1 Replies

5. Shell Programming and Scripting

perl replace command, stumped!

Ok, I stole some code from a program that takess a hash of a password from PasswdMD5 and replaces it in the /etc/shadown file on a linux system. I run his program and it's fine. Well I took the same code and put it in another program that won't ask for prompgx and such and this code won't work:... (2 Replies)
Discussion started by: benefactr
2 Replies

6. Shell Programming and Scripting

Stumped

Hi, I'm pretty new to UNIX shell scripting and need some help. We have an Informatica interface that dumps any files that have errors into a directory. I need to check that directory for any of up to 9 files that might be in it and run a specific process for each file found. Here's what I... (3 Replies)
Discussion started by: JeffR
3 Replies

7. Shell Programming and Scripting

I Am Stumped, Please Help

I have a CSV file that I am trying to parse with awk in a table. I think I am going about this the wrong way. I can't get the awk arrays to output with a tab between them in one line. They print out vertically and I need them to print out horizontally. WHAT AM I DOING WRONG?? I want to know if... (21 Replies)
Discussion started by: timj123
21 Replies

8. Shell Programming and Scripting

command line arg issue with awk

Hi friends, I am trying to pass input from command line and trying to print that column values. (FYI: I am using ksh) My code goes like this... #!/bin/sh column=$1 awk '{print $'$column'}' I execute using command like this --> ls -l | file_name parameter Hope I am clear with my... (2 Replies)
Discussion started by: divzz
2 Replies

9. UNIX for Dummies Questions & Answers

RegEx question has me stumped

Hi All, I'm fairly new to Regular Expressions, and have made some decent progress, but this one has me scratching my head. I'm trying to match the class name in my scripts as shown in the examples below. Any ideas? Thanks! -Mark :: Looking for a regex to match the red text :: import... (7 Replies)
Discussion started by: tolmark
7 Replies

10. IP Networking

httpd.conf - stumped

Have been asked to remove all images from being logged to the access_log ... where am I going wrong?<VirtualHost 123.456.789.99> ServerName www.somedomain.com.au DocumentRoot /agents/tts Redirect /wap http://somewap.com.au/traveler LogFormat "%v %h %l %u %t \"%r\" %>s %b" comonvhost... (2 Replies)
Discussion started by: Cameron
2 Replies
Login or Register to Ask a Question