Sponsored Content
Top Forums Shell Programming and Scripting Passing arguments from a bash shell script to a command Post 302601722 by burbly on Friday 24th of February 2012 09:05:00 AM
Old 02-24-2012
Passing arguments from a bash shell script to a command

I'm pretty new to bash scripting and I've found myself writing things like this (and the same with even more nesting):

Code:
    if $CATEGORIES; then
        if $LABEL_SLOTS; then
          $pyth "$wd/texify_grammar.py" "$input" "$texfile" "--label-slots" "--categories" "$CATEGORY_LIST"
        else
          $pyth "$wd/texify_grammar.py" "$input" "$texfile" "--categories" "$CATEGORY_LIST"
        fi
    else
        if $LABEL_SLOTS; then
          $pyth "$wd/texify_grammar.py" "$input" "$texfile" "--label-slots"
        else
          $pyth "$wd/texify_grammar.py" "$input" "$texfile"
        fi
    fi

There must be an easier way to do this... I've tried searching for the answer but haven't had much luck (probably because I don't know the right keywords to search for). Any help would be much appreciated!

Best wishes,
M
 

10 More Discussions You Might Find Interesting

1. Solaris

Passing arguments to a shell script from file while scheduling in cron

Hi, I have a shell script Scp_1.sh for which I have to pass 2 arguments to run. I have another script Scp_2.sh which in turns calls script Scp_1.sh inside. How do I make Scp_1.sh script to read arguments automatically from a file, while running Scp_2.sh? -- Weblogic Support (4 Replies)
Discussion started by: weblogicsupport
4 Replies

2. Shell Programming and Scripting

passing runtime arguments to a shell script...

hi I am new to shell programming.....my question is while running one of my shell program it stops in between to accept input from the user and proceeds furthur after giving input....I want to know whether I can set this input through some files so that the shell acript reads the input from the... (10 Replies)
Discussion started by: santy
10 Replies

3. Shell Programming and Scripting

Help required in passing multiple arguments from a shell script to a pl/sql block

Hi, hope everyone are fine. Please find my issue below, and I request your help in the same In a configuration file, i have a variable defined as below TEST = 'One','Two','Three' I am trying to pass this variable in to a sql script which is define in a pl/sql block as follows, In the... (1 Reply)
Discussion started by: ramakanth_burra
1 Replies

4. Shell Programming and Scripting

passing arguments to unix command or script inside tclsh

hi everobody kindly consider the following in tclsh I understand that we can do the following %exec UnixCmd arg1 arg2 but if I assinged the arguments to a list insde tclsh how can I use them back i.e %set ArgList %exec UnixCmd %exec Unixcmd $list %exec all the... (1 Reply)
Discussion started by: Blue_shadow
1 Replies

5. Programming

Passing arguments from java to script shell

Hello Please i want to pass parameter (the string s) to the shell script: Quote: String s="Hello"; Process process = Runtime.getRuntime().exec("sh script1.sh"); How can i do please? Thank you (0 Replies)
Discussion started by: chercheur857
0 Replies

6. Shell Programming and Scripting

Passing multiple arguments to a shell script

Hi Gurus, Need some help with the shell scripting here. #!/bin/ksh ps -ef | grep -i sample.ksh | grep -v grep > abc.txt if then echo "sample.ksh is executing" else echo "sample.ksh is not executing" fi (1 Reply)
Discussion started by: jayadanabalan
1 Replies

7. Shell Programming and Scripting

Passing arguments to a bash script

Hi, I wanted to pass an argument to a bash script. So that the argument is used inside the awk command inside the bash script. I know the noraml way of passing argument to a bash script as below : sh myScript.sh abc Inside the bash script i can use like this myArg1=$1 wc $myArg But... (8 Replies)
Discussion started by: shree11
8 Replies

8. Shell Programming and Scripting

Passing arguments to interactive program through bash script, here document

Dear Users, I have installed a standalone program to do multiple sequence alignment which takes user parameters to run the program. I have multiple sequence files and want to automate this process through a bash script. I have tried to write a small bash code but its throwing errors. Kindly... (13 Replies)
Discussion started by: biochemist
13 Replies

9. Shell Programming and Scripting

C shell script passing arguments problem.

I found something insteresting when I tested passing arguments into my scripts. My scripts is as below. % cat passarg.env #!/bin/csh echo "passarg: argv = $argv argv = $argv" passarg1.env $* % cat passarg1.env #!/bin/csh echo "passarg1: argv = $argv argvp=$argv" set str = "test... (5 Replies)
Discussion started by: bestard
5 Replies

10. UNIX for Beginners Questions & Answers

Passing Arguments to shell script from file is not working as expected.

Hi All, I have below simple shell script in cloudera quick start vm cenos 6 which copy file from source to destination. # file_copy.sh source_dir = ${source_dir} target = ${target_dir} cp source_dir target and my parameter file is like below #parameter_file.txt source_dir =... (4 Replies)
Discussion started by: Narasimhasss
4 Replies
PKCS11-TOOL(1)							   OpenSC Tools 						    PKCS11-TOOL(1)

NAME
pkcs11-tool - utility for managing and using PKCS #11 security tokens SYNOPSIS
pkcs11-tool [OPTIONS] DESCRIPTION
The pkcs11-tool utility is used to manage the data objects on smart cards and similar PKCS #11 security tokens. Users can list and read PINs, keys and certificates stored on the token. User PIN authentication is performed for those operations that require it. OPTIONS
--attr-from path Extract information from path (DER-encoded certificate file) and create the corresponding attributes when writing an object to the token. Example: the certificate subject name is used to create the CKA_SUBJECT attribute. --change-pin, -c Change the user PIN on the token --hash, -h Hash some data. --id id, -d id Specify the id of the object to operate on. --init-pin Initializes the user PIN. This option differs from --change-pin in that it sets the user PIN for the first time. Once set, the user PIN can be changed using --change-pin. --init-token Initialize a token: set the token label as well as a Security Officer PIN (the label must be specified using --label). --input-file path, -i path Specify the path to a file for input. --keypairgen, -k Generate a new key pair (public and private pair.) --label name, -a name Specify the name of the object to operate on (or the token label when --init-token is used). --list-mechanisms, -M Display a list of mechanisms supported by the token. --list-objects, -O Display a list of objects. --list-slots, -L Display a list of available slots on the token. --login, -l Authenticate to the token before performing other operations. This option is not needed if a PIN is provided on the command line. --mechanism mechanism, -m mechanism Use the specified mechanism for token operations. See -M for a list of mechanisms supported by your token. --module mod Specify a PKCS#11 module (or library) to load. --moz-cert path, -z path Test a Mozilla-like keypair generation and certificate request. Specify the path to the certificate file. --output-file path, -o path Specify the path to a file for output. --pin pin, -p pin Use the given pin for token operations. WARNING: Be careful using this option as other users may be able to read the command line from the system or if it is embedded in a script. This option will also set the --login option. --set-id id, -e id Set the CKA_ID of the object. --show-info, -I Display general token information. --sign, -s Sign some data. --slot id Specify the id of the slot to use. --slot-description description Specify the description of the slot to use. --slot-index index Specify the index of the slot to use. --token-label label Specify the label of token. Will be used the first slot, that has the inserted token with this label. --so-pin pin Use the given pin as the Security Officer PIN for some token operations (token initialization, user PIN initialization, etc). The same warning as --pin also applies here. --test, -t Perform some tests on the token. This option is most useful when used with either --login or --pin. --type type, -y type Specify the type of object to operate on. Examples are cert, privkey and pubkey. --verbose, -v Cause pkcs11-tool to be more verbose. NB! This does not affect OpenSC debugging level! To set OpenSC PKCS#11 module into debug mode, set the OPENSC_DEBUG environment variable to a non-zero number. --write-object id, -w path Write a key or certificate object to the token. path points to the DER-encoded certificate or key file. opensc 06/17/2014 PKCS11-TOOL(1)
All times are GMT -4. The time now is 11:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy