The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to get the value in last command line argument??? amit_oddey21 Shell Programming and Scripting 4 05-28-2008 07:40 AM
passing a command line argument rudoraj Shell Programming and Scripting 8 06-13-2007 11:06 PM
array as command line argument !!!! spandu UNIX for Dummies Questions & Answers 2 02-21-2006 01:33 PM
command line argument parsing rmjoe UNIX for Dummies Questions & Answers 1 07-28-2005 03:39 PM
command find returned bash: /usr/bin/find: Argument list too long yacsil Shell Programming and Scripting 1 12-15-2003 06:38 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-20-2008
nehagupta2008 nehagupta2008 is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 7
How to find the last argument in a argument line?

How to find the last argument in a argument line?
  #2 (permalink)  
Old 06-20-2008
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
The special variable $# would tell you
  #3 (permalink)  
Old 06-20-2008
benitdhotekar benitdhotekar is offline
Registered User
  
 

Join Date: May 2008
Posts: 9
Talking solution

hey this is the solution

for i in $*; do test $i ;done
print $i
  #4 (permalink)  
Old 06-20-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
or
Code:
echo $@ | awk '{ print $NF }'
if the last argument is not string of words with spaces in it
  #5 (permalink)  
Old 06-20-2008
apsprabhu apsprabhu is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 43
Hi,

The below command will display the last argument

echo $*|awk '{print NR, $NF}'
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:48 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0