problem with command line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting problem with command line
# 1  
Old 11-09-2007
problem with command line

i have a command line that looks like this:
my_command -a -b -c -d"foo bar" "./run this" param1 param2

I'm using getopt to pharse parameters -a -b -c -d.
after that i would like to execute "./run this" param1 param1 (which is places after --) but I'm loosing quotas around ./run this. How can i do this?

Here's the code:

Code:
#zczytanie parametrów
set +e
argumenty=$(getopt -o tmsdi:f:c: -- "$@")
if [ $? -ne 0 ]
then
    wyswietl_pomoc
fi
set -e

#przejście po argumentach i ustawienie odpowiednich flag
eval set -- "$argumenty"
for i
do
    case "$i"
    in
	-t)
	    czy_czas=$PRAWDA
	    shift;;
	-m)
	    czy_pamiec=$PRAWDA
	    shift;;
	-s)
	    czy_ogolne=$PRAWDA
	    shift;;
	-d)
	    czy_szczegolowe=$PRAWDA
	    shift;;
	-i)
	    bylo_co_jaki_czas=$PRAWDA
	    co_jaki_czas=$2
	    shift;shift;;
	-f)
	    format_wypisywania=$2
	    shift;shift;;
	-c)
	    ile_razy=$2
	    shift;shift;;
	--) shift; break;;
    esac
done

#przypisanie polecenia
polecenie="$@"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Problem with SFTP Command line, "@" in username.

Hi Guys Any help is appreciated very much! I'm trying to use SFTP to an external server using the native SFTP Client in RHEL 6 and 7. I've been given a username on the remote SFTP Server of myemail@myorg.com. I can not seem to escape that @ sign no matter what I do. I've tried these... (16 Replies)
Discussion started by: BG_JrAdmin
16 Replies

2. Shell Programming and Scripting

Perl command line option '-n','-p' and multiple files: can it know a file name of a printed line?

I am looking for help in processing of those options: '-n' or '-p' I understand what they do and how to use them. But, I would like to use them with more than one file (and without any shell-loop; loading the 'perl' once.) I did try it and -n works on 2 files. Question is: - is it possible to... (6 Replies)
Discussion started by: alex_5161
6 Replies

3. Red Hat

Problem in access the internet through command line

Hi Folks, I have installed Centos-6.4 in my VMware. I have enabled the proxy settings in the network and I am able to access the internet through GUI, but unable to browse via the command line. I did the below options as: 1) Added the proxy setting in /etc/environment file.export... (4 Replies)
Discussion started by: gsiva
4 Replies

4. Shell Programming and Scripting

sed command to replace a line at a specific line number with some other line

my requirement is, consider a file output cat output blah sdjfhjkd jsdfhjksdh sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf hellow there this doesnt look good et cetc etc etcetera i want to replace a line of line number 4 ("this doesnt look good") with some other line ... (3 Replies)
Discussion started by: vivek d r
3 Replies

5. Shell Programming and Scripting

Delete line with match and previous line quoting/escaping problem

Hi folks, I've list of LDAP records in this format: cat cmmac.export.tmp2 dn: deviceId=0a92746a54tbmd34b05758900131136a506,ou=devices,ou=customer,ou=nl,o=upc cmmac: 00:13:11:36:a5:06 dn: deviceId=0a92746a62pbms4662299650015961cfa23,ou=devices,ou=customer,ou=nl,o=upc cmmac:... (4 Replies)
Discussion started by: tomas.polak
4 Replies

6. UNIX for Dummies Questions & Answers

Problem with command line parameters

hi, This is actually realted to a Abinitio command in a unix script. my code is #!/bin/ksh GRAPH_NAME=$1 shift air sandbox run $GRAPH_NAME $* > file.lst 2>&1 if ]; then echo "Pass" fi when i run this script with this command "script.ksh graph_name parameters" the script... (1 Reply)
Discussion started by: siva1612
1 Replies

7. Shell Programming and Scripting

[Solved] Problem in reading a file line by line till it reaches a white line

So, I want to read line-by-line a text file with unknown number of files.... So: a=1 b=1 while ; do b=`sed -n '$ap' test` a=`expr $a + 1` $here do something with b etc done the problem is that sed does not seem to recognise the $a, even when trying sed -n ' $a p' So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies

8. Shell Programming and Scripting

problem with KSH script: command line args

Hi I am executing a KSH script by passing command line arguments example: Red Green Dark Red Blue when I am splitting the arguments by using " "(Space) as delimiter But the colour Dark Red is a single parameter. But it is getting splitted in between How to avoid this. Please help Also... (4 Replies)
Discussion started by: hemanth424
4 Replies

9. Shell Programming and Scripting

I need suggestion on problem read a file line by line and do stuff

At first, give my best wish for all MOD and admins here. I"m learning bash shell program just for a month, not too much, not too little, but i must admire that i'm very bad at math and algorithm. :( I want to do this : Read the content of a file line by line and at each line, ask me want to... (3 Replies)
Discussion started by: madi3d8
3 Replies

10. Shell Programming and Scripting

$line command problem

Hi all! I have a problem with line command. The aim is to write each line of stdin into a text file. For example with this command: $find / /usr/share/zoneinfo/WET /usr/share/zoneinfo/Zulu /usr/share/zoneinfo/iso3166.tab /usr/share/zoneinfo/localtime /usr/share/zoneinfo/zone.tab... (3 Replies)
Discussion started by: victorin
3 Replies
Login or Register to Ask a Question
scl(1)							      General Commands Manual							    scl(1)

NAME
scl - Setup and run software from Software Collection environment SYNOPSIS
scl <action> <collection1> [<collection2> ...] <command> scl <action> <collection1> [<collection2> ...] -- <command> scl {-l|--list} [<collection1> <collection2> ...] DESCRIPTION
This manual page documents scl, a program which is an utility for running software packaged as a Software Collection. scl utility allows to execute an application which is not located in the filesystem root hierarchy but is present in an alternative loca- tion. This application can still use and benefit from software installed in the root filesystem. In order to let an application be visible to the system one has to use scl utility as an interface. <action> is a script name to execute in a bash environment before the application itself takes in executed. Currently only enable scriptlet is mandatory which is needed to update search paths, etc. One can enable more Software Collections if needed and therefore one can use multiple collections which are enabled by the left-right order as present on scl command-line. <command> is an arbitrary command or set of commands to execute within the Software Collection environment enabled. Control is returned back to the caller with the original environment as soon as the command finishes. If <command> is '-' (dash) then it is read from the stan- dard input. Note: if you use <command> consisting of multiple arguments, you either need to use quotes or the -- command separator. Everything that follows the separator will be considered a command or its argument. Note: some commands modify user environment in some way. Those commands may potentially break SCLs, as their activation also usually depends on env. modification as well. Typical examples of such commands are su and sudo. Every collection modifies the environment differ- ently, thus more details may be found in the documentation of the particular collection. OPTIONS
-l, --list Lists all installed Software Collections on the system. -l, --list <collection1> <collection2> ... If a collection name is specified then list of installed packages belonging to the collection is listed. EXAMPLES
scl enable example 'less --version' runs command 'less --version' in the environment with collection 'example' enabled scl enable foo bar bash runs bash instance with foo and bar Software Collections enabled cat my_command | scl enable baz - run set of commands listed in my_command file in the environment with baz Software Collection enabled scl -l list all installed collections scl -l example list all packages within example collection AUTHOR
scl was written by Jindrich Novy <jnovy@redhat.com> and Jan Zeleny <jzeleny@redhat.com> scl(1)