09-04-2008
Tricky Quotation Question
Hi,
I am at a point in my script where I defined the number of the command line parameter I would like to set a variable equal to:
parameter_number=14
I would then like to set a variable equal to the correct parameter:
variable=$parameter_number
The issue here is that {} is required (ie. variable=${parameter_number}). What should I do so that the shell will expand the statement and set "variable" equal to my 14th command line parameter?
10 More Discussions You Might Find Interesting
1. Filesystems, Disks and Memory
I'm trying to answer the following question about file permissions in Unix. Consider a file with the following permissions:
rwx---r--
I am not the owner of this file, but I am a member of the group of this file.
My question is: do I have read access to this file?
I thought... (3 Replies)
Discussion started by: Hook
3 Replies
2. Shell Programming and Scripting
Hi,
I'm in the midst of writing a UNIX script that sftp's files to an external host and am stuck with a problem. The problem is that the files created on my server as a order number that correlates to a sequence of directories on the remote host which is where the file should be ftp'ed.
... (3 Replies)
Discussion started by: budrito
3 Replies
3. Shell Programming and Scripting
Hello everyone,
unfortunately I am no unix nor scripting guru, which is why I am asking for help here. I am trying to reformat a .csv file using sed or awk which has the following format:
a,b,C-D-E,f,g
h,i,J,k,l
m,n,O-P-Q-R-S,t,u
v,w,X-Y,z,a
It's basically a 5-field text file which has an... (7 Replies)
Discussion started by: awayand
7 Replies
4. Shell Programming and Scripting
This post is in reference to https://www.unix.com/shell-programming-scripting/137977-tricky-sed-awk-question-post302428154.html#post302428154
I am trying to go the opposite direction now:
I have the following file:
a,b,C,f,g
a,b,D,f,g
a,b,E,f,g
h,i,J,k,l
m,n,O,t,u
m,n,P,t,u
m,n,Q,t,u... (3 Replies)
Discussion started by: awayand
3 Replies
5. UNIX for Advanced & Expert Users
Hi colleagues,
I am development a script.
this flat file pp.txt contain this tree lines.
prueba
prueba1
prueba2
cat pp.txt |awk '{print a}' |while read a
do
var=`db2 select count(*) from $a`"
echo $var
done
executing var show me error.
I need var contain: db2... (1 Reply)
Discussion started by: systemoper
1 Replies
6. UNIX for Dummies Questions & Answers
I have some large login files that I need to extract (user)@(server) from. Where it gets tricky is that there is usually more than one '@' sign on each line(although it does have a leading space if it's not part of the (user)@(server) string), I need only the (user)@(server) section, I need only... (6 Replies)
Discussion started by: Mordaris
6 Replies
7. UNIX for Dummies Questions & Answers
Delete the post. (0 Replies)
Discussion started by: yifangt
0 Replies
8. Shell Programming and Scripting
I have some data files that I can identify by a certain pattern in the names using find.
Every one of those data files has an XML file associated with it (can be multiple data files per XML file).
The XML file is always up one directory from the data file(s) in a folder calledRun##### -... (12 Replies)
Discussion started by: Michael Stora
12 Replies
9. Shell Programming and Scripting
Hey guys, my first post on UNIX Forums(much overdue IMO)!
I've got this bit of code that doesn't seem to be working correctly for an Android app I'm working on:
"screen -S gmod1 -p 0 -X stuff " & "" & command.text & "`echo -ne '\015'`"""
Basically it types command.text(variable determined... (4 Replies)
Discussion started by: stingwraith
4 Replies
10. Shell Programming and Scripting
tail -n +7 1.txt |head -n -2|awk '{print "sql", $1,"-c groom table " $5 ,"versions"}'
sql DB1 -c groom table T1 versions
sql DB2 -c groom table T2 versions
sql DB3 -c groom table T3 versions
but i want out should be
sql DB1 -c "groom table T1 versions"
sql DB2 -c "groom table T2... (3 Replies)
Discussion started by: rocking77
3 Replies