Please explain the stmt


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Please explain the stmt
# 1  
Old 03-09-2009
Please explain the stmt

hi,

Please explain the below stmt.

P=1234
var1=:/a/b/c/file.dat

printf "%s %s\n" "$" "${var1#?}"


Output is:
1234 /a/b/c/file.dat

What is #? in printf stmt? by using that the first character( : ) of "var1" variable is not displayed in output. How is that? please explain..


Thanks,
Sri
# 2  
Old 03-09-2009
It is called "Parameter Expansion". Maybe this helps you
Shell Parameter Expansion
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Linux

How to use a case stmt in a for loop?

How can I merge the move statements with the "FOR" loop to do a move of a file right after it zips it and not wait until all of the files are zipped to move all outisde the for loop. Here is my current code: for file in `ls -rt $svdumpdir/* | grep -v '.gz$' | grep '.gtt$' ` do echo... (8 Replies)
Discussion started by: mrn6430
8 Replies

2. Shell Programming and Scripting

How to use GOTO stmt in Unix scripting?

my code does somthing like this: #!bin/ksh sqlplus / | While read id do temp=`echo $id` i = i+1 done j=0 while do --connecting to sql and executing a Stored proc for 1st id --checking for the status status = $? if error --need to... (1 Reply)
Discussion started by: RP09
1 Replies

3. Shell Programming and Scripting

Case Stmt - Need Help Urgently

Hello All, Need help urgently.. i have a scenario where i have two files 1) mireport_20111406.txt 2) PRLIHSP01_8080.2011-06-11-15_26_31 ---------- I want a query something similar to this algorithm :- Case when file_name is like mireport then extract_date=14-06-2011 when... (4 Replies)
Discussion started by: iamnoone
4 Replies

4. Shell Programming and Scripting

Problem comparing String using IF stmt

Hi frnds Im facing an issues while trying to compare string using IF stmt, my code is: chkMsgName=`Service Fee Detail` if then if then if then echo "Valid File Ready for processing" fi fi ... (5 Replies)
Discussion started by: balesh
5 Replies

5. Shell Programming and Scripting

Help with Dates and SQl stmt?

hi All Please explain the below statement in RED?What does this mean? perl /HDS/common/operations/Quality_Team/Nirvana/WEEKLY_OOPS/sql_dump.pl --sql "select * from WEEKLY_REPORT order by test_case, type" --username=ddb_qa --password=ddb_qa123 --sid=pldeldb --output... (1 Reply)
Discussion started by: SVS_2017
1 Replies

6. Shell Programming and Scripting

if stmt argument expected error

CT=0 while read LINE do # Check to see if the LINE is non-empty, and has a <td> tag in it. if then # Increase the TD counter by 1 CT=`echo "$CT+1"` fi done <test.htmthrows this error: ksh: test: argument expected test.htm <tr> <td>text</td... (4 Replies)
Discussion started by: dba_frog
4 Replies

7. Shell Programming and Scripting

I want to get the Unix variable value in the sql stmt

Hi All I have a requirement where in I am stuck. There is a shell script that is being developed by me. It consist of the sql stmt also. I need to export a variable called HOMEPAGE with a value say www.abc.com. and then use this $HOMEPAGE variable in the sql stmt. My ultimate aim is to fetch all... (1 Reply)
Discussion started by: amitsinha
1 Replies

8. Shell Programming and Scripting

Help with awk stmt

Hi All, I have a log file as: cat error.log.tmp1 2010-07-06 23:18:34 Connection Available to xyztestftp.abc.com.my 2010-07-06 23:20:33 Connection Available to xyztestftp.abc.com.my ERROR FTP LOGIN Now I am reading this complete log file if no single occurrence of word "ERROR" (this word... (5 Replies)
Discussion started by: ss_ss
5 Replies

9. Programming

Function Returning Value w/o return stmt

I am working on a C/Unix application from last 2 years which communicates with other systems using proprietary format of my client. We have a function written in C which returns integer, which is response from other system to the request message initiated by my system. This return value is then... (1 Reply)
Discussion started by: dpmore
1 Replies
Login or Register to Ask a Question