yetcom wrote:
Hello Everyone,
I have an issue regarding the bash. I have 2 different files and each
of them involves some float point numbers for each lines. I want to
subtract each line then put all the results into a file. The first
line float number will be subtract with the first line
DennisW wrote:
Mapfile would be that much more powerful if the callback function had
access to the current line. Is there any chance this might be added in
the future?
Can't answer directly on this, but it looks like the gateway between this
group and the mailing list hasn't worked for a
Daniel Bunzendahl wrote:
My question wasn't fokused on my wrong script. I think there is something
wrong or limited by the System...
Maybe you can give me a tip I should search for...
You've got it already...either invoke the script with its name (not through
bash), or use bash -- etc.
Curtis wrote:
Here's what I have but i'm getting some errors
#!/bin/bash
if ! (-e b.txt);
ITYM
if [ ! -e b.txt ]; then
...
Curtis wrote:
if [! -e b.txt];
Please note that should literally be
if [ ! -e b.txt ];
NOT
if [! -e b.txt];
Try running the latter and you'll get errors.
Peng Yu wrote:
$0 gives the file name of the script. I could use several shell
command to get the directory where the script is in. But I'm wondering
if there is an easy-to-use variable that refers to the directory where
the script is in?
See this page:
Marc Herbert wrote:
For purists, does this one works even better?
is_file3()
{
for f
do
[ -e $f -o -L $f ] return
done
return 1
}
You might also want to enable dotglob to catch hidden files...
Chris F.A. Johnson wrote:
On Thu, 10 Dec 2009, Marc Herbert wrote:
Does anyone know a more elegant way to check for file existence?
Something that does not fork a subshell. And is also more readable
maybe. And is obviously not much longer.
empty_dir()
{
test x$(echo $1/*$2) =
Rodney Varney III wrote:
Repeat-By:
View, fullscreen, view, uncheck show menubar
Where are you seeing any menubar in bash?
You're probably referring to the terminal in which bash is running. In that
case, it's likely that it's a problem with the specific terminal
implementation (eg gnome
phani krishna jampala wrote:
bash is not capable of comparing of strings ( imean interms of lessthan or
greater than etc)
It is, if you use [[ ]]
a=abcd
b=bcde
if [[ $b $a ]]; then
echo $b is greater than $a
fi
and real numbers ( the float values).
True, but I can't really speak as
pjodrr wrote:
in my original example the seq 4 runs in the current shell
while here the command runs in a subshell.
It would be nice if you explained what it is you're attempting to do, rather
than ask for a solution for what you're thinking would do that.
pjodrr wrote:
Hello,
how can I prefix every line of output of some command with a
timestamp? I thought like this:
$ exec 3 (while read line; do echo $(date): $line; done)
$ seq 4 3
Friday, December 4, 2009 4:20:29 PM MET: 1
$ Friday, December 4, 2009 4:20:29 PM MET: 2
Friday,
Michael O'Donnell wrote:
A bash function with a dot in its name can be created and used with no
problems but cannot be removed - the unset command chokes on the name.
Repeat-By:
This sequence yields the expected results:
function f() { echo $FUNCNAME ; }
f
unset f
visco wrote:
Could anyone tell me what is the purpose of $
I found it in a Makefile as follows
$(CXX) $(CXXFLAGS) -c $ -o $@
That's not a bash variable. It's a Makefile variable.
http://www.gnu.org/software/make/manual/make.html#Automatic-Variables
Also it would be nice if anyone
Marc Herbert wrote:
Chris F.A. Johnson a écrit :
Why should it be the last element of a pipeline that is executed in
the current shell and not the first?
Because that's POSIX' choice?
No, POSIX allow either behavior. In fact, it allows any behavior ranging
from running all parts
pk wrote:
Because that's POSIX' choice?
No, POSIX allow either behavior. In fact, it allows any behavior ranging
from running all parts in their own subshells, to running all parts in the
current shell.
...each command of a multi-command pipeline is in a subshell environment
Chet Ramey wrote:
r...@saturn.syslang.net wrote:
Description:
use of $( filename | program) does not work. It either should or it
should be properly documented. The problem also happens on bash4.
Repeat-By:
qq=$( /etc/passwd | grep sys)
echo $qq
# result is null
Fix:
Either fix
Antonio Macchi wrote:
$ printf \x00\n | cat -A
^@
it works, so why...
$ printf $'\x00' | cat -A
$
Read carefully ALL the answers you've been given. The short version is that
$'\x00' is interpreted by bash itself, while '\x00\n' is interpreted by
printf only. But DO READ the answers
Antonio Macchi wrote:
but...
$ printf one$'\x00'two\\n
+-+-+-+-+-+-+--+
|p|r|i|n|t|f|\0|
+-+-+-+-+-+-+--+
+-+-+-+--+-+-+-+--+--+
|o|n|e|\0|t|w|o|\n|\0|
+-+-+-+--+-+-+-+--+--+
so the output should be one, and stop here!
but the real output is
onetwo
so, imho, there's
Antonio Macchi wrote:
what's the rasonable limit in using this compact contruct, after which
the for (( i=0; i1000...; i++ )) became better?
You didn't even bother trying eh?
$ for i in {0..10}; do echo $i/dev/null; done
bash: xmalloc: ../../../bash/lib/sh/stringvec.c:40: cannot
Antonio Macchi wrote:
I'm on error, I know... but, in your bash-ref guide you don't explain a
lot printf
and in man printf don't do it too...
from man printf
-
NOTE: your shell may have its own version of printf, which usually
supersedes the version
Amit Dor-Shifer wrote:
I've the following script:
set -eE
on_error() { echo ERROR ERROR; }
trap on_error ERR
if [ -n $(echo $1 |grep a) ];then
echo input contains 'a'
fi
When executed under bash-4, on_error is evaluated as part of the
expression in the 'if'. This does not happen
ken wrote:
This is what I get on Linux running on an i686.
Bash should be smart enough to know that 09 = 9
-- and it does sometimes, but not all the time.
Surprise!!
From the bash manual:
Constants with a leading 0 are interpreted as octal numbers. A leading 0x
or 0X denotes hexadecimal.
Sam Steingold wrote:
this:
foo=`ls`
echo $foo
will print files in one line even though ls prints them with newlines.
is there a way to preserve newlines in the above echo?
thanks.
echo $foo
rjustinwilli...@gmail.com wrote:
Hi all
I have, on a 64-bit system an issue with time hanging. I've installed
multiple versions, one at a time, and gotten the same results on each
version.
If I use tcsh, instead of bash, time works.
With bash 3.17, I got a seg fault; with the other
On Friday 5 June 2009 20:28, Till Maas wrote:
Aloas,
I often need the results of expansion like {01..10} to be prefixed with
zeros, currently I always need to have two expansions, e.g.
cat foo0{1..9}.bar foo{10..23}.bar
It would be nice if I could use e.g.
cat foo{01..23}.bar
On Thursday 28 May 2009 21:58, Linda Walsh wrote:
But when I used regex pattern matching in the if, the spaces around the
operator
caused a failure in matching. I.e.:
if [[ $Var=~+([:digit:]) ]] ; then ...
worked.
worked in the sense that [[ .. ]] evaluated a single argument: the
string
On Thursday 28 May 2009 22:38, pk wrote:
Yes, if the second argument is quoted, it's treated as a literal string.
If you want the regex behavior, you should not quote it:
if [[ $Var =~ +([:digit:]) ]]; then .
That behavior changed at some point during 3.2 (too lazy to check now
On Wednesday 20 May 2009 21:34, jjjaime wrote:
I would like to execute some functions in parallel, but the last method
has to wait until the first 2 functions have finished.
The script is:
FUNCTION_1() {
...
}
FUNCTION_2() {
...
}
FUNCTION_3() {
...
}
FUNCTION_1
FUNCTION_2
On Thursday 16 April 2009 11:11, Mart Frauenlob wrote:
for i in $(seq 0 15755500); do echo $i; done
-bash: xrealloc: ../bash/subst.c:512: cannot reallocate 182209024 bytes
(0 bytes allocated)
ok, thesis looks confirmed...
I'm no C programmer, but I try to think logically about it.
There
On Friday 3 April 2009 03:33, Brandon F wrote:
When I do traceroute in bash I am always getting
12-215-11-193.client.mchsi.com as the third or fourth site. I want to know
how to clear this from my route list. So it will bounce off of a differant
site. Thank you.
traceroute | sed
On Monday 2 March 2009 23:34, lehe wrote:
Hi,
I have some questions about the paragraph in Bash Reference on
redirections: Note that the order of redirections is significant. For
example, the command
ls dirlist 21
directs both standard output (file descriptor 1) and standard error
On Monday 23 February 2009 07:31, Antonio Macchi wrote:
Yes, it's ok. Posix says that printf field widths are specified in
number of bytes.
I've never red nothing about POSIX,
You should, especially if posting here something like that.
but imho, in the past, char and
byte was
On Sunday 5 October 2008 17:17, Antonio Macchi wrote:
#!/bin/bash -e
trap rm test_fifo 0
mkfifo test_fifo
ls / test_fifo
exec 90
while read dirname
do
echo $dirname
# if I wait, exits!!!
read -t 2 -p press enter... 09
done test_fifo
exec 9-
exit 0
You know
On Tuesday 22 July 2008 13:38, Lawrence D'Oliveiro wrote:
And even with the specialness of bang turned off, it still doesn't work
right:
[EMAIL PROTECTED]:~ set +H
[EMAIL PROTECTED]:~ echo hi there!
hi there!
[EMAIL PROTECTED]:~ echo hi there\!
hi there\!
[EMAIL PROTECTED]:~ echo hi
On Friday 18 July 2008 07:35, Lawrence D'Oliveiro wrote:
pk wrote:
This is documented in man bash, and only happens in interactive shells
(not scripts).
I just tried putting my six cases into a script, and I get exactly the
same sort of output as interactively.
On my system, I get
On Wednesday 16 July 2008 04:47, Lawrence D'Oliveiro wrote:
Description:
In all contexts in which a character X has special meaning to bash, it
should be possible to insert that character literally by writing \X.
This fails in one case: where X is !, and the context is inside double
quotes.
On Sunday 11 May 2008 04:16, Chet Ramey wrote:
pk wrote:
The man page says that bash builtin printf supports the standard
printf(1) formats. But it seems that \u is not working:
$ /usr/bin/printf '\u212b\n'
Å
$ printf '\u212b\n'
\u212b
Am I doing something wrong here?
The `\u
On Friday 18 April 2008 14:02, Dave Rutherford wrote:
Quotes or escapes in the output of the `` are input to the shell rather
than shell syntax, so won't be interpreted. You just need to quote more.
$ foo () { echo sony; echo apple; echo hewlett packard; }
Now note the difference
On Friday 18 April 2008 14:02, Dave Rutherford wrote:
Quotes or escapes in the output of the `` are input to the shell rather
than shell syntax, so won't be interpreted. You just need to quote more.
$ foo () { echo sony; echo apple; echo hewlett packard; }
Now note the difference
40 matches
Mail list logo