473,387 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

what does :=0 mean in shell scripting

Hi,

Could anyone please let me know what does it mean by the following statement in solaris shell scripting.

$PROMPT " Select an option: "
read ans
db_option=${ans:=0}

I wanted to know the interpretation for this last line. what does it mean by :=0

Please let me know asap.
Oct 8 '08 #1
1 4127
One would think it means 'oh-no!!!'

Truth is, it is a bash shell construct for assigning a default value. In this case, it means 'if they don't give me a value, use zero'.

Google up bash-shell default-value for info, or see here, about 2/3's of the way down the page, for a default values title.

http://www.ibm.com/developerworks/library/l-bash-parameters.html?ca=drs-

The section offers a slightly technical recap that talks about :+, :-, := and :? Luckily, the more technical part is something most users won't need right away -- it gets into substitution timing (before or after using the default), and it also has a snippet of code you can experiment with until you get the hang of the nuances, *if you really need 'em*.

G'luck, mate.
Oct 8 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Chris Cioffi | last post by:
I started writing this list because I wanted to have definite points to base a comparison on and as the starting point of writing something myself. After looking around, I think it would be a...
11
by: tdi | last post by:
Ok, stupid question for the day. I'm reading the interview with Steve Moret and he says: "Once a lot of scripts started going in we knew there was no way we could back out of using Python." I'm...
17
by: Jared | last post by:
This is going to seem like a generic question that has been posed 1001 times and is probably very subjective, but I need some real world answers, rather than textbook answers. Let me give my...
19
by: DW | last post by:
Hi, all... I have a sizeable database running under Oracle 9.2.0.4 under AIX 5.2.0. I am faced with an impending move to a Windows environment, running under SQL 2000. Currently, we are...
9
by: Josh Mayfield | last post by:
Note: There is considerable background detail here, but I do have three questions, which are clearly marked and appear right before the sample code. I have a legitimate need to launch an EXE...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
1
by: marlene | last post by:
Dear Tom With this code: Public Function FTP(ascii As Boolean, send As Boolean, pathname As String, FileName As String, server As String, serverpathname As String, serverfilename As String,...
10
by: A.M | last post by:
Hi, I am having difficulty with shell scripting in Python. I use the following command to run a DOS command and put the return value in a Python variable:
13
by: notbob | last post by:
Grrr.... I'm following A Byte of Python and into the while loops chap. I cp/paste while.py to a file and give 777 perms. I mv while.py to while and run it (./while) as a standalone script. I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.