Jonathan Dowland wrote:
> On Sun, Nov 03, 2013 at 09:58:58PM +0100, Erwan David wrote:
>> Maybe you'll need something like expect to handle this.
> I'd second expect, it's probably the best tool for the job in all
> non-trivial cases.
The "empty-expect" package, perhaps?
Chris
--
To UNSUBSCRI
On 11/4/13, Thomas H. George wrote:
> The script I am trying to write executes a program that requires a
> keyboard response. I have experimented with redirecting STDIN but haven't
> found the
> correct way to make the response.
To read a value (perhaps half your "problem"):
apt-cache show ...
z
Hi
On Sun, Nov 03, 2013 at 02:35:30PM -0500, Thomas H. George wrote:
> The script I am trying to write executes a program that requires a
> keyboard response. I have experimented with redirecting STDIN but haven't
> found the
> correct way to make the response. I found one example that scanned t
The tool 'yes' can be used to write an infinite stream of strings
(the default being 'y') to standard output, so if your program needed
only a sequence of a fixed string such as 'y', you could do
> yes | your-program
or
> yes "some-other-string" | your-program
But if your program is not readin
Le 03/11/2013 20:35, Thomas H. George a écrit :
> The script I am trying to write executes a program that requires a
> keyboard response. I have experimented with redirecting STDIN but haven't
> found the
> correct way to make the response. I found one example that scanned the
> response from apt
> The script I am trying to write executes a program
> that requires a keyboard response.
>
A varaible can be set to a keyboard response
using a read prompt
read -e -p "What do you need ?" xVariable
echo $xVariable
--
Stanley C. Kitching
Human Being
Phoenix, Arizon
The script I am trying to write executes a program that requires a
keyboard response. I have experimented with redirecting STDIN but haven't found
the
correct way to make the response. I found one example that scanned the
response from apt-get install for the letter y and fed this back to
in
Here's something I modified as part of a benchmark script called "fdtree".
--
Karl Vogel I don't speak for the USAF or my company
Dijkstra probably hates me. --Linus Torvalds, in kernel/sched.c
#!/bin/bash
# How to use xdate/xtime/persec:
#
# START=$(date "+%s")
On 2010-03-29 16:35, Mike McClain wrote:
[snip]
Thanks a lot. Though my error was pointed out as a typo and corrected
a while back your solution using " date '+%s' " is much more elegant
than what I had done.
If you want more (possibly too much) precision:
$ date +'%s.%N'
--
"History does not
Hi Josep,
On Mon, Mar 29, 2010 at 02:28:20PM +0200, Josep M. wrote:
>
> I found these somewhere time ago. check if is what You need:
>
Thanks a lot. Though my error was pointed out as a typo and corrected
a while back your solution using " date '+%s' " is much more elegant
than what I had don
Hello.
I found these somewhere time ago. check if is what You need:
function timer()
{
if [[ $# -eq 0 ]]; then
echo $(date '+%s')
else
local stime=$1
etime=$(date '+%s')
if [[ -z "$stime" ]]; then stime=$etime; fi
dt=$((etime - stime)
Paul E Condon wrote:
Try:
bgn=$(date +%s)
sleep 7
end=$(date +%s)
echo "elapsed seconds = " $(( end - bgn ))
You might also want to experiment with:
ps h -o etime $$
as long as you're happy with it only running under gnu. Prints the
elapsed time for the shell.
--
Chris Jackson
Shadowcat
On 20100319_101928, Mike McClain wrote:
> I've written a function to print elapsed time similar to /usr/bin/time
> but can be called at the beginning and end of a script from within
> the script. Occasionally I get an error: '8-08: value too great for base'
> It's caused by the difference in these
On Fri, Mar 19, 2010 at 06:45:15PM +0100, Sven Joachim wrote:
> On 2010-03-19 18:19 +0100, Mike McClain wrote:
>
> > I've written a function to print elapsed time similar to /usr/bin/time
> > but can be called at the beginning and end of a script from within
> > the script. Occasionally I get an e
On Fri, Mar 19, 2010 at 10:19:28AM -0700, Mike McClain wrote:
typo right herevv
> now='09:07:16'; startHr=${now%%:*}; startHR=${startHr#*0}; echo $startHr;
Apologies for troubling all.
Mike (with egg on face)
--
Satisfied user of Linux since 1997.
O< ascii ribbon c
Mike McClain wrote:
I've written a function to print elapsed time similar to /usr/bin/time
but can be called at the beginning and end of a script from within
the script. Occasionally I get an error: '8-08: value too great for base'
It's caused by the difference in these 2 command strings but I ca
Mike McClain wrote:
I've written a function to print elapsed time similar to /usr/bin/time
but can be called at the beginning and end of a script from within
the script. Occasionally I get an error: '8-08: value too great for base'
It's caused by the difference in these 2 command strings but I c
On Fri, Mar 19, 2010 at 1:19 PM, Mike McClain wrote:
> I've written a function to print elapsed time similar to /usr/bin/time
> but can be called at the beginning and end of a script from within
> the script. Occasionally I get an error: '8-08: value too great for base'
> It's caused by the diffe
On 2010-03-19 18:19 +0100, Mike McClain wrote:
> I've written a function to print elapsed time similar to /usr/bin/time
> but can be called at the beginning and end of a script from within
> the script. Occasionally I get an error: '8-08: value too great for base'
> It's caused by the difference i
I've written a function to print elapsed time similar to /usr/bin/time
but can be called at the beginning and end of a script from within
the script. Occasionally I get an error: '8-08: value too great for base'
It's caused by the difference in these 2 command strings but I can't for
the life of m
Tyler Smith wrote:
On 2007-05-17, Bob McGowan <[EMAIL PROTECTED]> wrote:
Some general comments, mostly aimed at making your code cleaner without
changing what it does.
First, both 'echo' and 'printf' put their results on standard out. Your
call of 'printf' is inside command substitution, so
On Thu, May 17, 2007 at 03:40:15AM +, Tyler Smith wrote:
> On 2007-05-17, Bob McGowan <[EMAIL PROTECTED]> wrote:
> >
> > Some general comments, mostly aimed at making your code cleaner without
> > changing what it does.
> >
> > First, both 'echo' and 'printf' put their results on standard out.
On 2007-05-17, Bob McGowan <[EMAIL PROTECTED]> wrote:
>
> Some general comments, mostly aimed at making your code cleaner without
> changing what it does.
>
> First, both 'echo' and 'printf' put their results on standard out. Your
> call of 'printf' is inside command substitution, so its STDOUT
Tyler Smith wrote:
Hi,
I've got a question about a short bash script I wrote. I need it to
--snipped--
#!/bin/bash
lab_num=41
for map_name in aest_90 bush_90 carol_90 comp_90 \
hirs_90 roan_90 swan_90 vir_90 ;
do
lab_let=$(echo -n $(printf "\\x$(echo $lab_num)"))
echo "
$la
On 2007-05-16, Karl E. Jorgensen <[EMAIL PROTECTED]> wrote:
>> This was the only way I could figure out to loop from A to H. But
>> since it works on hex escape codes, it won't work past 9. Is there a
>> cleaner, more general way to do this?
>
> I think there is:
>
> #!/bin/bash
>
> ( cat < A aest_
On Wed, May 16, 2007 at 08:46:37PM +, Tyler Smith wrote:
> Hi,
>
> I've got a question about a short bash script I wrote. I need it to
> loop over a number of names, and pass a command to grass that includes
> two variations of those names. That was easy. Harder was getting
> getting a letter
Hi,
I've got a question about a short bash script I wrote. I need it to
loop over a number of names, and pass a command to grass that includes
two variations of those names. That was easy. Harder was getting
getting a letter included in each iteration, starting with A for the
first one and going u
On 11/25/05, Metrics <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Can someone explain to me the following behaviour? I have this script
>
> #!/bin/sh
>
> LISTS=('debian-user' 'security-basics' 'hostap' 'pen-test' 'ntbugtraq'
> 'ion-general' 'vim' 'madwifi');
> LIST_COUNT=${#LISTS}
> echo $LIST_COUNT
>
Hi all,
Can someone explain to me the following behaviour? I have this script
#!/bin/sh
LISTS=('debian-user' 'security-basics' 'hostap' 'pen-test' 'ntbugtraq'
'ion-general' 'vim' 'madwifi');
LIST_COUNT=${#LISTS}
echo $LIST_COUNT
for ((i=0;i<$LIST_COUNT-1;i++)); do
echo /home/bhillis/Ma
Matt Price <[EMAIL PROTECTED]> writes:
> here's something that ocmes up a lot for me:
>
> I use locate to find a bunch of files:
>
> % locate charter | grep -i font
> /usr/share/texmf/fonts/afm/bitstrea/charter
> /usr/share/texmf/fonts/tfm/bitstrea/charter
> /usr/share/texmf/fonts/type1/bitstrea
On Sun, Jan 04, 2004 at 02:27:11AM -0500, Matt Price wrote:
[...]
} ls < locate charter | grep -i font
} ?
} nothing I try works -- but I can't believe it's impossible! any
} hints?
locate charter | grep -i font | tr '\012' '\000' | xargs -0 ls -ld
xargs is your friend. So is tr. Learn them an
On Sat, 03 Jan 2004 23:34:59 -0800, Nano Nano wrote:
> On Sun, Jan 04, 2004 at 02:27:11AM -0500, Matt Price wrote:
>> so I have to do it by hand at the moment. But shouldn't I be able to
>> automate it with somthing like:
>>
>> ls < locate charter | grep -i font
>> ?
>> nothing I try works -- b
On Sun, Jan 04, 2004 at 03:36:36AM -0500, Kevin Mark wrote:
> I use a little bash code over and over again.
> Its a while loop.
>
> locate charter| grep -i font | while read line; do
> ls -l $line;
> done
>
> It has many uses and it doesnt have a limit like xargs.
> I found out about xargs
On Sun, Jan 04, 2004 at 01:10:51AM -0800, Nano Nano wrote:
[snip]
> it looks messier) and you can't use the sort options of less, for
i meant sort options of ls
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
On Sun, Jan 04, 2004 at 03:36:36AM -0500, Kevin Mark wrote:
[snip]
>
> locate charter| grep -i font | while read line; do
> ls -l $line;
> done
Invoking 'ls' in a loop is semantically different from invoking it once,
although you can compensate for it. I prefer backticks because you can
On Sun, Jan 04, 2004 at 02:27:11AM -0500, Matt Price wrote:
> hey folks,
>
> here's something that ocmes up a lot for me:
>
> I use locate to find a bunch of files:
>
> % locate charter | grep -i font
> /usr/share/texmf/fonts/afm/bitstrea/charter
> /usr/share/texmf/fonts/tfm/bitstrea/charter
>
On Sun, Jan 04, 2004 at 02:27:11AM -0500, Matt Price wrote:
> so I have to do it by hand at the moment. But shouldn't I be able to
> automate it with somthing like:
>
> ls < locate charter | grep -i font
> ?
> nothing I try works -- but I can't believe it's impossible! any
> hints?
I use back
hey folks,
here's something that ocmes up a lot for me:
I use locate to find a bunch of files:
% locate charter | grep -i font
/usr/share/texmf/fonts/afm/bitstrea/charter
/usr/share/texmf/fonts/tfm/bitstrea/charter
/usr/share/texmf/fonts/type1/bitstrea/charter
/usr/share/texmf/fonts/vf/bitstre
On Sun, Nov 03, 2002 at 12:28:26PM -0700, Bob Proulx wrote:
> get around 40,000 files in one single directory. Some filesystems
> such as JFS (and I think, not sure, XFS and ReiserFS too) store
> directies in B+ trees and are specifically designed to handle large
I know that ReiserFS does this. X
Neal Lippman <[EMAIL PROTECTED]> [2002-11-03 13:35:22 -0500]:
> Thanks. My "bug" here was using comma instead of space as the separator,
> and not realizing that the reason for x in {a,b,c,d...z} worked was
> because of the way the brace expansion was being done by the shell.
Ah, yes, csh style {o
On Sat, Nov 02, 2002 at 10:51:00PM -0500, Neal Lippman wrote:
>
> This works fine if I actually type out the entire alphabet list on the
> command line as above, but that's sort of a pain. So, I tried setting a
> shell variable to the alphabet string (export alpha="A,B,C,...,Z"), but
> then the co
Neal Lippman <[EMAIL PROTECTED]> [2002-11-02 22:51:00 -0500]:
> I am trying to solve a bash scripting problem, but I cannot figure it
> out.
>
> I frequently need to execute a command of the form:
> for x in {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z); do
>;
[EMAIL PROTECTED] <[EMAIL PROTECTED]> [2002-11-03 18:15:06 +0200]:
> On Sat, Nov 02, 2002 at 10:05:45PM -0600, Michael Heironimus wrote:
> > alpha="a b c d e z"
> > for x in $alpha ; do
> > echo $x
> > done
> >
> > I think this should work in any Bourne-style shell
>
> Doesn't wo
Matthias Hentges <[EMAIL PROTECTED]> [2002-11-03 18:32:29 +0100]:
> Am Son, 2002-11-03 um 04.51 schrieb Neal Lippman:
> > I frequently need to execute a command of the form:
> > for x in {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z); do
> Your problem ist the wrong setting of th
Am Son, 2002-11-03 um 04.51 schrieb Neal Lippman:
> I am trying to solve a bash scripting problem, but I cannot figure it
> out.
>
> I frequently need to execute a command of the form:
> for x in {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z); do
>;
> don
On Sat, Nov 02, 2002 at 10:05:45PM -0600, Michael Heironimus wrote:
> On Sat, Nov 02, 2002 at 10:51:00PM -0500, Neal Lippman wrote:
> > shell variable to the alphabet string (export alpha="A,B,C,...,Z"), but
> > then the command:
> > for x in {$alpha} ;
> > do
> > echo $x;
> >
On Sat, Nov 02, 2002 at 10:51:00PM -0500, Neal Lippman wrote:
> shell variable to the alphabet string (export alpha="A,B,C,...,Z"), but
> then the command:
> for x in {$alpha} ;
> do
> echo $x;
> done
> winds up printing the string "{A,B,C,...,Z}" rather than each l
I am trying to solve a bash scripting problem, but I cannot figure it
out.
I frequently need to execute a command of the form:
for x in {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z); do
;
done
This works fine if I actually type out the entire alpha
Thank you all! Now it works.
* Gustavo Noronha Silva <[EMAIL PROTECTED]> [020320 09:25]:
...
> C="$A $B"
--
Karsten Heymann <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
CAU-University Kiel, Germany
Registered Linux User #221014 (http://counter.li.org)
On Tue, Mar 19, 2002 at 08:35:53PM +0100, Karsten Heymann wrote:
> Hi,
>
> I have once again come upon bash problem I can't solve. I'm writing a
> little bash frontend and one of the programs expects a option that includes
> spaces and is composed from two other shell var's. Example:
>
> #!/bin/b
Karsten Heymann, Tue, Mar 19, 2002 at 08:35:53PM +0100:
> Hi,
>
> I have once again come upon bash problem I can't solve. I'm writing a
> little bash frontend and one of the programs expects a option that includes
> spaces and is composed from two other shell var's. Example:
>
> #!/bin/bash
> A=
On Tue, 19 Mar 2002 20:35:53 +0100
Karsten Heymann <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have once again come upon bash problem I can't solve. I'm writing a
> little bash frontend and one of the programs expects a option that includes
> spaces and is composed from two other shell var's. Example:
Karsten Heymann <[EMAIL PROTECTED]> writes:
> Hi,
>
> I have once again come upon bash problem I can't solve. I'm writing
> a little bash frontend and one of the programs expects a option that
> includes spaces and is composed from two other shell var's. Example:
>
> #!/bin/bash
> A="Hello"
> B="
On Tue, 19 Mar 2002, Karsten Heymann wrote:
> Hi,
>
> I have once again come upon bash problem I can't solve. I'm writing a
> little bash frontend and one of the programs expects a option that includes
> spaces and is composed from two other shell var's. Example:
>
> #!/bin/bash
> A="Hello"
> B=
On Tue, Mar 19, 2002 at 20:35:53 +0100, Karsten Heymann wrote:
> A="Hello"
> B="Karsten"
> C=$A $B
> someprog --greeting $C
Variable expansion happens first:
someprog --greeting Hello Karsten
then tokenising, so someprog get three arguments:
1. --greeting
2. Hello
On Tue, Mar 19, 2002 at 08:35:53PM +0100, Karsten Heymann wrote:
> Hi,
>
> I have once again come upon bash problem I can't solve. I'm writing a
> little bash frontend and one of the programs expects a option that includes
> spaces and is composed from two other shell var's. Example:
>
> #!/bin/b
This should work, though I have not actually tried it:
#!/bin/bash
A="Hello"
B="Karsten"
C="$A $B"
someprog --greeting "$C"
pgpiX8Z2JqpWm.pgp
Description: PGP signature
Hi,
I have once again come upon bash problem I can't solve. I'm writing a
little bash frontend and one of the programs expects a option that includes
spaces and is composed from two other shell var's. Example:
#!/bin/bash
A="Hello"
B="Karsten"
C=$A $B
someprog --greeting $C
Whatever I do now, -
58 matches
Mail list logo