473,722 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what does :=0 mean in shell scripting

56 New Member
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 4163
Sageword
6 New Member
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
3000
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 waste of time to start writing yet another IDE and so am now thinking in terms of new features/plug-ins for existing systems. Right now I mostly use Komodo Personal and it's pretty close to being what I want. They don't currently support plug-ins,...
11
2334
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 just getting into Python and am wondering if I'm missing something or this is just a semantic issue. Thanks. -Ted
17
2899
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 background in 2-3 sentences: 1. I am a developer who has been programming for about 3 years and have done the following: - Java (1 year experience) - Visual Basic 6 (Done quite a few in house utility and add on programs)
19
2479
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 heavy users of shell scripts, for exports, backups, etc.
9
8146
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 from an HTML page on Windows XP/Internet Explorer. The EXE is already locally installed, and the HTML page is also viewed locally on the PC- it's not a web site. I know of two ways to do this, both of which are featured in the sample HTML file at...
121
10119
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 support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
1
1338
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, username As String, password As String, Optional RstN As String, Optional RstFld As String) Dim Fs As Object Dim a As Variant
10
2271
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
1453
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 get errors. Here is the script: while.py
0
8863
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9384
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9238
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.