unix script trouble

 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions unix script trouble
# 1  
Old 02-03-2011
Error unix script trouble

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:
Hi I am new to unix and need some help, the main reason I am here is because i need basic unix knowledge
The question for university says this :

"If the command procedure contains the command echo $ {d-.} what will it bring?"
I tried googling it but no results where found, I asked in other forums but no one knew

Thanks for the help

2. Relevant commands, code, scripts, algorithms:



3. The attempts at a solution (include all code and scripts):



4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
I am attending at the New Bulgarian University, Bulgaria, Sofia.
This question was made by professor Gadzev for the course CSCB58

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

Moderator's Comments:
Mod Comment I have modified your post to fit the template that (in future) you must use when submitting in the homework forum.

Last edited by Scott; 02-03-2011 at 12:51 PM.. Reason: Template
# 2  
Old 02-03-2011
Space characters are important.
I expect you mean:
Code:
echo ${d-.}

In words it means that the default value for the environment variable $d is a period character. So if there is nothing in $d the shell will put a period character in the variable for you.

Code:
For example:
unset d
echo ${d-.}
.

d=423
echo ${d-.}
423

# 3  
Old 02-03-2011
You can easily find this information by reading the man page for the shell you are using.

From the man page, search for Parameter Expansion.

Code:
${parameter:-word}
              If parameter is set and is non-null then substitute its value; otherwise substitute word.
...
If the colon ( : ) is omitted from the above expressions, then the shell only checks whether parameter  is  set or not.

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Linux/UNIX Bash Shell Script trouble help needed!!

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 2. Shell Bash Script 3. !/bin/bash if echo no directory then mkdir -p /home/AC_Drywall elif ; then echo "$dir already exist" fi (4 Replies)
Discussion started by: TomFord1
4 Replies

2. Shell Programming and Scripting

Trouble in getting user input while using CASE statement in UNIX

i want to get user input like this please tell which option to chose 1. mango 2. tango 3. rango if user chooses mango then it should execute a set of statements and again ask like this what do you want to do 1.add 2.subtract 3.exit when i choose exit it should goto my previous menu... (4 Replies)
Discussion started by: s.deepak
4 Replies

3. Shell Programming and Scripting

!!VERY URGENT!! Trouble in getting user input, while using under CASE statement in UNIX

i want to get user input like this please tell which option to chose 1. mango 2. tango 3. rango if user chooses mango then it should execute a set of statements and again ask like this what do you want to do 1.add 2.subtract 3.exit when i choose exit it should goto my previous... (1 Reply)
Discussion started by: s.deepak
1 Replies

4. Shell Programming and Scripting

trouble looping in script

I am having problem looping this script I want to give the user option to decide if they want to continue after each entry but then also loop it back to beginning so they can more to content of there testcase they just created. I fam new to scripting so loops are little tricky for me. code I... (7 Replies)
Discussion started by: andrew.p.mcderm
7 Replies

5. UNIX for Dummies Questions & Answers

trouble with snmpwalk script

I am using a line of code that I borrowed from someone else's script, in a script to monitor changes in my local network. It works but it takes too long to pick up the changes. snmpwalk -v 2c -c PASSWORD -Oq 10.0.1.1 RFC1213-MIB::atPhysAddress The snmp server is my apple router. If I monitor... (7 Replies)
Discussion started by: chancho
7 Replies

6. UNIX for Dummies Questions & Answers

Having trouble finding good unix study material

I am trying to read about a UNIX distribution list but I cannot seem to find out what it is or where I can find a website to read more on it any help would be greatly appreciated (2 Replies)
Discussion started by: starshot
2 Replies

7. Shell Programming and Scripting

trouble in running script

HI admin unix, I'm from indonesia that currently work as system admin for server under AIX/UNIX environment. I have some trouble when running script as follow : ## vdate() { sqlplus -s ${MMUSER}/${PASSWORD} <<-eot|grep -v '^$' set heading off feedback off select... (2 Replies)
Discussion started by: cahyo3074
2 Replies

8. UNIX for Dummies Questions & Answers

Trouble with UNIX tr (translate) function

UNIX script - problem. I want the spaces in my Item variable to be replaced with a question mark. Can you tell me what I am doing wrong? This is the whole code line. Item | tr -s " " "?" Why is this not making any changes to the Item value? Thanks for any help you can give! tg (2 Replies)
Discussion started by: by_tg
2 Replies

9. Shell Programming and Scripting

trouble with script

I'm having a little trouble finishing up this script any help would be great. My system is SCO OpenServer Enterprise System (ver 5.0.5m) and i'm using sh This script checks todays date and goes and downloads a file with yesterdays date in the name. ---start---- Server="ipaddresshere"... (4 Replies)
Discussion started by: whegra
4 Replies
Login or Register to Ask a Question