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
Help With Double Sustitution Mohammed Shell Programming and Scripting 1 08-13-2007 02:53 AM
grep throws in dashes? kingdbag UNIX for Dummies Questions & Answers 3 04-27-2007 04:18 PM
Double screen cordobapablo UNIX for Dummies Questions & Answers 0 10-11-2006 11:13 AM
help removing dashes from social security number Marcia P UNIX for Dummies Questions & Answers 2 02-28-2006 09:10 PM
double GUI problem adunkey UNIX for Advanced & Expert Users 2 11-18-2003 05:53 AM

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 05-16-2006
systemsb systemsb is offline
Registered User
  
 

Join Date: Jan 2006
Posts: 23
double dashes

function date_diff
{
integer _dt1=$(date_to_num ${1:?})
integer _dt2=$(date_to_num ${2:?})
integer _ndt=0
if [[ $_dt2 -gt $_dt1 ]]
then
((_ndt=_dt2-_dt1))
fi
print -- $_ndt
}


What does double dash '--' indicate ?
Can anyone please answer this
  #2 (permalink)  
Old 05-16-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
print can have options like this:
print -u2 message
And option are recognized by the leading dash. So "print -3" looks like an erroneous option is being specified. "print -- -3" is the solution. -- means no more options follow.
  #3 (permalink)  
Old 05-18-2006
thestevew thestevew is offline
Registered User
  
 

Join Date: Mar 2006
Location: South Yorkshire, UK
Posts: 114
The "--" option for print allows you to print strings starting with a "-".

e.g. without --
Code:
 
$print "- some text"
ksh: print: 0403-010 A specified flag is not valid for this command.
with --
Code:
$ print -- "- some text"
- some text
Print -r (raw print) works too but also ignores escape sequences.

cheers
Sponsored Links
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 04:52 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