LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 02-07-2005, 10:37 AM   #1
Steve Riley
Member
 
Registered: Jan 2005
Location: Dallas
Distribution: Suse
Posts: 94

Rep: Reputation: 15
shell scripting - using ${variable:=","}


In Wicked Cool Shell Scripts on page 18 toward the bottom I see:

result="${TD:=","}${remainder}${result}"

What does the ${TD:=","} do?

The variable TD is assigned elsewhere in the script (on page 19).

Thanks,

Steve
 
Old 02-07-2005, 11:06 AM   #2
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Rep: Reputation: 35
What is Wicked Cool Shell Scripts???
 
Old 02-07-2005, 11:11 AM   #3
Steve Riley
Member
 
Registered: Jan 2005
Location: Dallas
Distribution: Suse
Posts: 94

Original Poster
Rep: Reputation: 15
A book of shell scripts by Dave Taylor. Published by No Starch Press.
 
Old 02-07-2005, 11:13 AM   #4
Padma
Member
 
Registered: Aug 2003
Location: Omaha, NE, USA
Distribution: PCLinuxOS 2007
Posts: 808

Rep: Reputation: 30
${TD:=","} Use the variable "TD" if it is set. If it is not set, assign it the value ",", and then use it.
 
Old 02-07-2005, 11:36 AM   #5
LasseW
Member
 
Registered: Oct 2004
Distribution: Fedora 7, OpenSuse 10.2
Posts: 108

Rep: Reputation: 15
For a complete list of conditional assignment statements, do 'man bash' and read the paragraph 'Parameter Expansion'.
 
Old 02-07-2005, 11:45 AM   #6
Steve Riley
Member
 
Registered: Jan 2005
Location: Dallas
Distribution: Suse
Posts: 94

Original Poster
Rep: Reputation: 15
Thanks. I've run into this and:

${variable#?}

and

${variable%pattern}

but I haven't found a place where these parsing/assignment operators are listed.
 
Old 02-07-2005, 11:47 AM   #7
Steve Riley
Member
 
Registered: Jan 2005
Location: Dallas
Distribution: Suse
Posts: 94

Original Poster
Rep: Reputation: 15
OK. There it is. Thanks.
 
Old 02-08-2005, 05:07 AM   #8
heema
Senior Member
 
Registered: Sep 2003
Location: Egypt
Distribution: Arch
Posts: 1,528

Rep: Reputation: 46
I just wanted to say thanks for pointing out that book , it seams llike a really good shell scripting book , just what i was looking for
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Script: Find "Word" Run "Command" granatica Linux - Software 5 07-25-2007 07:42 AM
No UTMPX entry, You must EXEC "login" for the lowest "shell" ooihc Solaris / OpenSolaris 7 03-12-2007 02:09 PM
shell scripting: variable problem XST1 Programming 7 01-30-2005 01:45 PM
Bash Script: Problem running variable command containing "" Paasan Programming 2 01-21-2004 01:45 AM
Shell Scripting: Users "**Never logged in**" cparker15 Linux - General 1 10-02-2003 03:48 PM


All times are GMT -5. The time now is 03:07 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration