use of parenthesis() in shell programming


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting use of parenthesis() in shell programming
# 1  
Old 06-20-2010
use of parenthesis() in shell programming

What's the use of parenthesis () in shell programming ?
I saw this in one of the posts in this forum :
Code:
echo $($1)

What confounded me was that it evaluated the inner expression and then the outer one, almost like eval. It seemed like it did this in passes.
# 2  
Old 06-20-2010

It is for using the output of one command in another command, frequently to populate a variable:
Code:
output=$( $1 )

The ouput of the command in $1 will be stored in the variable $output.
This User Gave Thanks to cfajohnson For This Post:
# 3  
Old 06-20-2010
Thanks a lot !
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removing spaces between parenthesis ()

Hello, i 've go a file with the following text: oracle@das (J005) 0 oracle@das (J008) 0 oracle@das (J050) 0 oracle@das (J038) ... (15 Replies)
Discussion started by: nms
15 Replies

2. Shell Programming and Scripting

How to get value from a close and open parenthesis?

Hi Gurus, I have an input like the one below. What i wanted to achieved is to create a select statement based from that information INPUTInsert into table_name (col1,col2,col3,col4,col5,DATE1,DATE2,col6,col7,col8,col9,col10,col11) values (6752,14932156,24,'ALL','Staff',to_date('04/17/2017... (6 Replies)
Discussion started by: ernesto
6 Replies

3. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

4. Shell Programming and Scripting

sed help adding parenthesis

I have the following data and want to put parenthis around the numbers: PARTITION PERIOD_MIN VALUES LESS THAN 10649 TABLESPACE ODS_DAILY_MF_AUM, PARTITION PERIOD_10649 VALUES LESS THAN 10650 TABLESPACE ODS_DAILY_MF_AUM, PARTITION PERIOD_10650 VALUES LESS THAN 10651 TABLESPACE... (2 Replies)
Discussion started by: BeefStu
2 Replies

5. Shell Programming and Scripting

extract first argument in parenthesis

I have a file that, among other things, contains a tuple with words and the word count. I want to make a list of the words only. Ex: My file words.txt looks like: 0.1 sw-wn 9 - n: 97/903 p: 107/893neg: (film,771.1) | (movie,717.1) | (like,690.1) | (just,621.1) | (it's,607.1) | (time,543.1) |... (4 Replies)
Discussion started by: erinbot
4 Replies

6. Shell Programming and Scripting

Cleanup between parenthesis

Hi, I am trying to clean up data between parenthesis () in a file. See example below.... Input File : (New York) Chicago (London) New York (Chicago) London New York Chicago (London) (New York) (Chicago) (London) New York (Chicago) ... (3 Replies)
Discussion started by: msalam65
3 Replies

7. Shell Programming and Scripting

parse data between parenthesis using shell script

Hi I am using shell script and i need to parse the data between parenthesis.How do i do it using shell script. Ex: section(name). I want to extract name from the above string using shell script. (4 Replies)
Discussion started by: julie_s
4 Replies

8. Programming

how to check parenthesis in MSVC++

how do i turn on the option to check for opening and closing parenthesis in Microsoft VC++? I remember there is a setting somewhere in the options in the MS VC++ environment but not sure.. thanks (4 Replies)
Discussion started by: npatwardhan
4 Replies

9. UNIX for Dummies Questions & Answers

another sed question about parenthesis

hi, I'm trying to use sed to erase everything, up to, and including, the first closing parenthesis. for example: input: blah blah blah (aldj) test (dafs) test test. output: test (dafs) test test. how would i do this? I was fooling around with the parenthesis, and i only got it to apply to... (5 Replies)
Discussion started by: gammaman
5 Replies

10. UNIX for Dummies Questions & Answers

Shell Programming

I have a fix_table.ksh script that takes a TABLENAME and a date. So, in jk_table_file.txt I have the tables...one per line, and in jk_out_file.txt I have the date in the format I need. The following doesn not 'want' to work in a shell script... for TABLE in `cat jk_table_file.txt`; do ... (2 Replies)
Discussion started by: JWK1
2 Replies
Login or Register to Ask a Question