Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Passing command output as an argument to a shell script Post 302407000 by methyl on Wednesday 24th of March 2010 10:21:50 AM
Old 03-24-2010
Please state what shell you are using?

Quote:
sh testscript.sh ' ls -t Appl*and*abc* | head -n 1'

This will list one file name as ana argument..
It won't. The single quotes '' will stop execution of the "ls" command line and pass the whole "ls" command line intact as a parameter to testscript.sh.
What is the contents of "testscript.sh"? Does it contain an "eval" command?

I think we need to know in words what you are trying to achieve?
Consider what input you will provide, what processing is required, and what output you expect.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem when passing argument to a shell script

Hi all, I'm new to Shell scripting. In my shell script for Bourne shell, the script accepts a date parameter which is optional. If the value is supplied, the supplied value should be assigned to a variable. If not, the current date will be assigned to the variable. My script is like this. #!... (9 Replies)
Discussion started by: sumesh.abraham
9 Replies

2. UNIX for Dummies Questions & Answers

pipe output to script as command line argument

i want to redirect output of one command as the command line argument of another script for example, say i would run this command: find . -xdev -type f -size +4096 -exec ls -al {} \; i wan to be able to do something like: echo +4096 | find . -xdev -type f -size ****** -exec... (3 Replies)
Discussion started by: IMTheNachoMan
3 Replies

3. Shell Programming and Scripting

passing argument to shell script that reads user inputs

Hi, Lets say I have a script "ss" which does this read abc echo $abc read pqr echo $pqr Now if I want to pass and argument to only "abc" how do I do it. If I do echo "somevalue" | ss, it does not prompt for pqr and its value comes out as blank. Any help is appreciated Thanks P (6 Replies)
Discussion started by: patjones
6 Replies

4. Shell Programming and Scripting

Need Help with the argument passing Through Command line

$$$$$ (5 Replies)
Discussion started by: asirohi
5 Replies

5. UNIX for Dummies Questions & Answers

Passing command line argument between shell's

Hi, I am facing a problem to pass command line arguments that looks like <script name> aa bb "cc" dd "ee" I want to pass all 5 elements include the " (brackets). when I print the @ARGV the " disappear. I hope I explain myself Regards, Ziv (4 Replies)
Discussion started by: zivsegal
4 Replies

6. Shell Programming and Scripting

Passing argument to a script while executing it within current shell

Hi Gurus, I have written a script set_env.ksh to which I pass an argument and set the oracle login credentials based on the argument I pass. The script has code as below. ORACLE_SID=$1 DB_SCHEMA_LOGON=$DB_SCHEMA_USER/$DB_SCHEMA_PASSWORD@$ORACLE_SID; export DB_SCHEMA_LOGON; echo... (3 Replies)
Discussion started by: Sabari Nath S
3 Replies

7. Shell Programming and Scripting

Passing value as a command line argument in awk script.

I have one working awk command line. Which taking data from the “J1202523.TXT” file and generating the “brazil.dat” file. PFB code. awk '{ DUNS = substr($0,0,9);if ( substr($0,14,3) == "089" ) print DUNS }' J1202523.TXT > Brazil.dat But now I want to pass two parameter as a command line argument... (4 Replies)
Discussion started by: humaemo
4 Replies

8. Programming

Passing argument to command in C

Hello all, New to C and I'm trying to write a program which can run a unix command. Would like to have the option of giving the user the ability to enter arguments e.g for "ls" be able to run "ls -l". I would appreciate any help. Thanks #include <stdio.h> #include <unistd.h> #include... (3 Replies)
Discussion started by: effizy
3 Replies

9. Shell Programming and Scripting

passing either of argument, not both in shell

Hi, I have a requirement to work on script, it should take either of arguments. wrote it as below. #!/bin/bash usage() { echo "$0: missing argument OR invalid option ! Usage : $0 -m|-r|-d } while getopts mrdvh opt; do case "$opt" in m) monitor_flag=monitor;;... (1 Reply)
Discussion started by: ramanaraoeee
1 Replies

10. Shell Programming and Scripting

Passing argument from Java to Shell script

Hi All, I want to pass array of argument from Java to a shell script.I can use process builder api and its exec() method to call the script,but the question is how to receive the parameter in the script. Thanks in advance ---------- Post updated at 10:00 PM ---------- Previous update was... (1 Reply)
Discussion started by: Abhijeet_Atti
1 Replies
DBAMSG(1)						      General Commands Manual							 DBAMSG(1)

NAME
dbamsg - Work with encoded meteorological data SYNOPSIS
dbamsg [command] [options] [args...] DESCRIPTION
Examine, dump and convert files containing meteorological data. It supports observations encoded in BUFR, CREX and AOF formats. dbamsg always requires a non-switch argument, that indicates what is the operation that should be performed: help Print a help summary. help manpage Print this manpage. scan [options] [filter] filename [filename [...]] Summarise the contents of a file with meteorological data. dump [options] [filter] filename [filename [...]] Dump the contents of a file with meteorological data. cat [options] [filter] filename [filename [...]] Dump the raw data of a file with meteorological data. convert [options] [filter] filename [filename [...]] Convert meteorological data between different formats. compare [options] filename1 [filename2] Compare two files with meteorological data. fixaof [options] filename [filename1 [...]]] Recomputes the start and end of observation period in the headers of the given AOF files. makebufr [options] filename [filename1 [...]]] Read a simple description of a BUFR file and output the BUFR file.. Read a simple description of a BUFR file and output the BUFR file. This only works for simple BUFR messages without attributes encoded with data present bitmaps. bisect [options] --test=testscript filename Bisect filename and output the minimum subsequence found for which testscript fails.. Run testscript passing parts of filename on its stdin and checking the return code. Then divide the input in half and try on each half. Keep going until testscript does not fail in any portion of the file. Output to stdout the smallest portion for which testscript fails. This is useful to isolate the few messages in a file that cause problems. head [options] [filter] filename [filename [...]] Dump the contents of the header of a file with meteorological data. OPTIONS
dbamsg follows the usual GNU command line syntax, with long options starting with two dashes (`-'). Options used to filter messages --category=num match messages with the given data category --subcategory=num match BUFR messages with the given data subcategory --check-digit=num match CREX messages with check digit (if 1) or without check digit (if 0) --unparsable match only messages that cannot be parsed --parsable match only messages that can be parsed --index=expr match messages with the index in the given range (ex.: 1-5,9,22-30) Option for command scan -?, --help print an help message --verbose verbose output -t type, --type=type format of the input data ('bufr', 'crex', 'aof') Option for command dump -?, --help print an help message --verbose verbose output -t type, --type=type format of the unput data ('bufr', 'crex', 'aof') --interpreted dump the message as understood by the importer --precise import messages using precise contexts instead of standard ones --text dump as text that can be processed by dbamsg makebufr --csv dump in machine readable CSV format --dds dump structure of data description section --structured structured dump of the message contents Option for command cat -?, --help print an help message --verbose verbose output -t type, --type=type format of the input data ('bufr', 'crex', 'aof') Option for command convert -?, --help print an help message --verbose verbose output -t type, --type=type format of the input data ('bufr', 'crex', 'aof', 'csv') -d type, --dest=type format of the data in output ('bufr', 'crex', 'aof') --template=name template of the data in output (autoselect if not specified, 'list' gives a list) -r rep_memo, --report=rep_memo force output data to be of this type of report --precise import messages using precise contexts instead of standard ones --recompute-categories recompute data categories and subcategories according to message contents Option for command compare -?, --help print an help message --verbose verbose output -t type, --type1=type format of the first file to compare ('bufr', 'crex', 'aof') -d type, --type2=type format of the second file to compare ('bufr', 'crex', 'aof') Option for command fixaof -?, --help print an help message --verbose verbose output Option for command makebufr -?, --help print an help message --verbose verbose output Option for command bisect -?, --help print an help message --verbose verbose output --test=cmd command to run to test a message group -t type, --type=type format of the input data ('bufr', 'crex', 'aof') Option for command head -?, --help print an help message --verbose verbose output -t type, --type=type format of the input data ('bufr', 'crex', 'aof') EXAMPLES
Here are some example invocations of dbamsg: # Convert an AOF message to BUFR dbamsg convert file.aof > file.bufr # Convert a BUFR message to CREX dbamsg convert file.bufr -d crex > file.crex # Convert BUFR messages to CREX, but skip all those not in january 2010 dbamsg convert year=2010 month=1 file.bufr -d crex > file.crex # Dump the content of a message, as they are in the message dbamsg dump file.bufr # Dump the content of a message, interpreted as physical quantities dbamsg dump --interpreted file.bufr TEMPLATE NAMES
This is a list of possible template names for the --template switch: acars ACARS (autodetect) acars-ecmwf ACARS ECMWF (4.145) acars-wmo ACARS WMO airep AIREP (autodetect) airep-ecmwf AIREP ECMWF (4.142) amdar AMDAR (autodetect) amdar-ecmwf AMDAR ECMWF (4.144) amdar-wmo AMDAR WMO buoy Buoy (1.21) generic Generic (255.0) metar Metar (0.140) pilot Pilot (2.91) pollution Pollution (8.171) ship Synop ship (autodetect) ship-abbr Synop ship (abbreviated) (1.9) ship-auto Synop ship (auto) (1.13) ship-plain Synop ship (normal) (1.11) ship-reduced Synop ship (reduced) (1.19) synop Synop (autodetect) synop-ecmwf Synop ECMWF (autodetect) (0.1) synop-ecmwf-auto Synop ECMWF land auto (0.3) synop-ecmwf-land Synop ECMWF land (0.1) synop-ecmwf-land-high Synop ECMWF land high level station (0.1) synop-wmo Synop WMO (0.1) temp Temp (autodetect) temp-ecmwf Temp ECMWF (autodetect) temp-ecmwf-land Temp ECMWF land (2.101) temp-ecmwf-ship Temp ECMWF ship (2.102) temp-ship Temp ship (autodetect) temp-wmo Temp WMO (2.101) wmo WMO style templates (autodetect) --template=list will also print the list. AUTHOR
dbamsg has been written by Enrico Zini <enrico@enricozini.com> for ARPA Emilia Romagna, Servizio Idrometeorologico. may 16, 2012 DBAMSG(1)
All times are GMT -4. The time now is 12:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy