Programming :: Get The Getopts Command To Run?

May 12, 2010

im trying to get the getopts command to run but for some reason the -d option fails to populate the variable and it remains empty.

Code:
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options

[Code].....

View 2 Replies


ADVERTISEMENT

Programming :: Non-GNU Based Getopts For Java?

Jul 29, 2010

I'm looking for a version of Getopts for Java that isn't licensed under the GPL and accepts long options (i.e. both -h and --help). My code is licensed under BSD and I don't really want to change that just because a module uses the GPL...

View 1 Replies View Related

Programming :: Effect Of Using Eval To Execute A Command As Opposed To Writing It On The Command-line?

Jun 18, 2010

Code: cmd='date | wc'

$cmd If this script is executed, an error is generated. The reason written was that "The execution fails because the pipe is not expanded and is passed to date as an argument".What is meant by expansion of pipe. When we execute date | wc on the command line, it goes fine.then | is not treated as an argument. Why?

View 4 Replies View Related

Programming :: Command Line Invocation Of Gnome-terminal To Run More Than One Command?

Feb 16, 2010

I am trying to learn how to pass more than a one-command startup for gnome-terminal.

I will give an example of what I'm trying to do here:

Code:
#! /bin/bash
#
#TODO write this for gnome and xterm
USAGE="
${0##*/} [-x] [-g]
code....

However, running with the -g option to invoke gnome-terminal, I get a "There was an error creating the child process for this terminal" error.

This same error occurs if the gnome-terminal line is changed to

Code:
gnome-terminal -e mcTerm

Is there any way to pass more than one command on to gnome-terminal? I have tried various single and double quoting senarios and in a final attempt, I abstracted to an exported function all to no avail. Perhaps even though gnome-term is better at many things than xterm, xterm trumps it in this instance.

View 4 Replies View Related

Programming :: System Command / 'mcc' Is Not A Recognised As An Internal Or External Command?

Apr 13, 2010

I am writing a perl script which uses the matlab compiler to compile a .m file.

I am using the system("mcc �m file.m"). I have matlab installed and both script and exe are in the same drive.But i get the following error .

'mcc' is not a recognised as an internal or external command ,operable in program or batch file.

View 5 Replies View Related

Programming :: Show The Output Of Shell Command Into A Textbox, Ex Ps -efc Command?

Oct 20, 2010

I am using gtk to program GUI. How can I show the output of shell command into a textbox, ex ps -efc command ?

View 3 Replies View Related

Programming :: Convert This Awk Command From Command Line Into An Awk Script ?

Oct 15, 2010

I'm trying to convert this awk command from command line into an awk script, but just cannot get it to work:

This is what i have after my BEGIN

Am i missing something here? this just prints out the count for everyline, not counting lines on 5th field that match 'A'

View 1 Replies View Related

Programming :: Calling Command From History Using Variable Like !$command?

Nov 19, 2008

suppose i store the history number of a command say :

1004 cat file

Then now i want to run it like : !1004 but by using a variable.

command=1004
!$command

i am getting errors like :

command=1004command

View 2 Replies View Related

Programming :: Bash Ambiguous Redirect - Redirect One Command Output Which Will Be Treat As A Content Of File For Another Command?

Mar 9, 2011

I am trying to grep multiple numbers from file, grep does have the -f option for that.

Code: grep -f <`seq 500 520` /etc/passwd I know this could be done with

Code: for i in `seq 500 520`; do grep "$i" /etc/passwd; done But my question is fare more behind this example. It is possible to redirect one command output which will be treat as a content of file for another command ?

View 2 Replies View Related

Programming :: Command To Run Another One On Few Lines

Jul 23, 2010

Is there a command which can be used to run some other command on a few lines from a file or an o/p of some file. (the kind of role that -exec option does for the find command). (I have solved the purpose using a bash loop but would like to know if there exists a command).

View 4 Replies View Related

Programming :: Cp Command -f Is Not HAPPENING?

Mar 20, 2011

What's the deal with this bloody commandI trying to do an update of a product.The -f is suppose to "force" the overwrite of existing files isn't it?Well every time I run the command it keeps asking me to allow it to overwrite the files.. the programs is too long for me to sit here hitting the "y" and "enter key"

View 2 Replies View Related

Programming :: Use The Seq Command But Can't Get It To Work?

Mar 24, 2011

I have a script that will build a list of hosts and it works fine Code: for ((i=$START; i<=$END; i++)); do echo "$NAME$i"; done But I need it to build the START and END on different number formats (i.e. 1 -> 10, 01->10, 001 ->010)

I am trying to use the seq command but can't get it to work quite right with the -w flag in the following Code: for ((myseq=$START; myseq<=$END; myseq ++)) do echo "$NAME${myseq}" done I am fully aware that this syntax is probably wrong, and need to know how to correct it.

View 1 Replies View Related

Programming :: Add New Command In Minix?

Mar 12, 2011

Is anyone familiar with the Minix OS? i want to know what is the Process to add a new command in Minix that uses system call served by the memory manager server

View 1 Replies View Related

Programming :: Bash Command From PHP?

Jul 14, 2011

Distro: Centos 5, PHP 5I have done a bit research on running bash commands from php and there was little success. This is my relevant php script

<?php
echo exec('pwd');
?>

[code]...

View 16 Replies View Related

Programming :: How To Integrate Ls Command In C++

Aug 19, 2010

I just create a simple c++ program on linux is there a way to intergrate linux command such as ls, du, df and etc on my c++ program?

View 1 Replies View Related

Programming :: Use Fg Foreground Command?

Apr 16, 2010

I have many processes running that printf local debug. (they will log to file later!) I start them by

Code:
( sleep 20000000 | fp ) & else they get killed/stop by themselves. So now its running in the background, I want to bring it to the front to see the printfs.

[Code]....

View 14 Replies View Related

Programming :: Joining Command In Csh?

Feb 3, 2009

I did a search for this but did not see anything relevant.I'm trying to join several strings and execute them as a command but csh does not seem to recognize it as a command, anyone know what I'm doing wrong? numone and numtwo will be passed into the script. (I have to use csh because it is a part of an existing script.)

Code:
#!/bin/csh
set file1=file.dat

[code]...

View 5 Replies View Related

Programming :: Using Sed Command Twice On One File?

May 11, 2009

what i have is a list of words 6 to a line im trying to use the sed command to insert a comma in between each word and at the end of the last one

[code]....

the last line of the variable does not have 6 words what i have so far is this

Code:

words=`cat /usr/share/dict/words |grep "^[$list]*$" | xargs -n 6 echo | sed -e 's/[ ]+/,/g s/$/,/g'`

it dosent work though i originally started off with

Code:

words=`cat /usr/share/dict/words |grep "^[$list]*$" | xargs -n 6 echo | sed -e 's/[ ]+/,/g' this puts a comma inbetween them but takes out the space and dosent put a comma at the end of the line.. basicaly what i needed to know is how i could you multiple sed commands to fix this

View 12 Replies View Related

Programming :: How To Create Sed Or Awk Command

Apr 7, 2011

How would I create a sed or awk command that would add a | to the end of a line if it wasn't already there? I'm trying to import some files into mysql, but some of the lines to not end with a | which is my field delmiter.

View 14 Replies View Related

Programming :: Using Variable In A Command?

Apr 14, 2011

i'm trying to execute a shell script, i'm trying to use the values in an array for use in a sed command:

sed -n '/Sales ID: ${array[$i]}/,/Totals:/p'

that command creates empty files. so my guess is that its not recognizing the array as an array but as text?
how would i be able to utilize the array in the command? i got it, didnt think that if i doubled up the single quotes that it would work, but this worked:

sed -n '/Sales ID: '${array[$i]'}/,/Totals:/p'

View 4 Replies View Related

Debian Programming :: How To Use Shell Command

Sep 6, 2013

How to use shell command?

installs.sh:

Code: Select allapt-get install icedove-l10n-hu
apt-get install rar
apt-get install ...
...
y press key or other language is other key. hungarian key is: i

english after apt-get install in gnome-terminal: (y)es or (n)o
hungarian after apt-get install in gnome-terminal: (i)gen or (n)em

How to yes or no automatically in all languages? Not manual, not 'Y'/'I' or 'N'/'N' keydown.

I would like use this script my fresh installed Debian 7.1. I would like run this install.sh when Debian is installed for my all softwares when i would like use.

10 PC installing easy and faster my script.

If no script is slowly install for my 10 PC.

View 2 Replies View Related

Debian Programming :: Sh Command Strings

Feb 8, 2014

I use udhcp with some of my minimal installs. I've messed around with the code a bit when it wasn't working correctly - a few years ago. I will find time - I hope soonish - to figure out how to do a few other things with it.

For now though, I'm using this string to grab my ip after startup

Code: Select allsu -c 'ifconfig eth0&&ifdown -a&&ifup lo&&ifup eth0'&&/sbin/ifconfig eth0

I realize I could substitute ifup -a but I'm more interested in figuring out how to make ifup wait for the ip to become available if it is not available yet.

Never mind that one, just typing out the question answered it for me, when I find it in the scripting man ' ; : " & =

Or if there are any other suggestions for better construction of the string.

View 2 Replies View Related

Programming :: Best Command To Use To Parse Strings?

Mar 24, 2010

what is the best command to use to parse strings?I have a variable $str and need to parse this string.Can you provide an example of the command used to get a substring of $str based on the index values of start and end

View 3 Replies View Related

Programming :: Detection Of A Command In Shell?

Apr 2, 2010

I would like to know if there is any way to detect a command if it going to be executed in the shell?

Eg:
Cmd: sudo apt-get clean I want a C program to be called before this cmd is executed.

View 8 Replies View Related

Programming :: BASH: Get PID Of First Command In Pipe

Aug 11, 2010

I understand that $! is the PID of a command. For example:

Code: #!/bin/bash
myprogram &
echo "PID of myprogram is $!"

I'd like to send the output of "myprogram" to both console and to a log file using the "tee" command but I also want to store the PID of "myprogam". Something like this:

Code: #!/bin/bash
myprogram | tee ./logfile &
echo "PID of myprogram is $!"

The problem is that $! is now the PID of "tee" rather than the PID of "myprogram".

View 3 Replies View Related

Programming :: Using AWK Within Bash Command Via Xargs

Mar 24, 2011

I often want to extract some info using awk from a variable/filename while running other things using xargs and sh. Below is an example:
Code: ls -1 *.txt | xargs -i sh -c 'NEW=`echo $0 | awk -F'_' '{print $1}'`; echo $NEW' {}

In the above case I would like to grab just the first field from a filename (delimited by '_') from within an sh command. This is a simplified example, where normally I would be doing some further data processing with the sh command(s).

The error message that I get is:
Code: }`; echo $NEW: -c: line 0: unexpected EOF while looking for matching ``'
}`; echo $NEW: -c: line 1: syntax error: unexpected end of file.
I haven't been able to figure out how to escape the awk command properly.

View 1 Replies View Related

Programming :: Redirection From A File To Command?

Apr 18, 2011

I am always confused about the redirection operator <Lets say i have a file input.txt that contains one word "hello" without the quotes when i do the following why don't i see any output? $echo < input.txt Secondly, i am slightly confused between input redirection < and pipe | operator. Sometimes they seem to do the same thing. For example i can achieve the output from the above command as follows $ cat input.txt | xargs echo

View 2 Replies View Related

Programming :: What The Dot (.) Infront Of The Command Or Script

Jan 16, 2011

Anyway, just wanting to know if someone can please explain what the dot (.) infront of the command or script does and why it works and does not work in the following?

Code:

I did a which db01env and it says it is not found even though /u02/bin/oracle is included in the PATH environment variable. I believe this is because db01env is not executable and the which command only checks for executables, is that a correct assumption/guess?

Am not having issues at the moment but just curious how a single dot could make such a big difference that it can make or break stuff.

View 3 Replies View Related

Programming :: Can't Get The Syntax Right In This Pyqt3 Command?

Mar 14, 2010

Code:
x = self.spinbox37.value() * 40
y = self.spinbox38.value() * 40

[code]...

View 1 Replies View Related

Programming :: Cut Command Wont Work?

Mar 3, 2010

on linux command promt cut command work.but the same command gives empty output in linus shell?F1=$(echo $line | cut -s -f26) NOT working in shellcat file | cut -s -f26 work!

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved