Search Results

Search: Posts Made By: elbrand
1,199
Posted By elbrand
Here the response to my bug report: So...
Here the response to my bug report:



So the behaviour is as intended. ;;& means: continue to look for a matching pattern.
1,199
Posted By elbrand
Ok, I'm going to send a bug report. Thank you...
Ok, I'm going to send a bug report. Thank you very much!
1,199
Posted By elbrand
But, following the man page, shouldn't the ;;&...
But, following the man page, shouldn't the ;;& terminator test only the next pattern list 2) : ;; and not also *) echo x ;;?
1,199
Posted By elbrand
Wrong case behaviour?
The following case statement should not execute the "echo x" in my opinion, but it does. I'm pondering if this is a bug and I should send a bug report or not. Tested in fully patched bash version 4.4...
9,121
Posted By elbrand
you need to give the parameters of the script to...
you need to give the parameters of the script to the call of the function:

main_logic ${@}
1,983
Posted By elbrand
You are right. It's the same behaviour as in C...
You are right. It's the same behaviour as in C (and I like C). So, thank you for the discussion. You changed my mind.
1,983
Posted By elbrand
I don't want to struggle, but IMO there are at...
I don't want to struggle, but IMO there are at least two ways to make the same arithmetic expression:

((B=0))
returning 1

and

declare -i B ; B=B+0
returning 0

and I only wanted to point...
1,983
Posted By elbrand
Hm, I found the point in the man page now. It was...
Hm, I found the point in the man page now. It was imho a bad decision to change the behaviour of the (()) expression. Why should a successful expression return a non zero exit code?

And still it...
1,983
Posted By elbrand
You are right - thank you very much! I couldn't...
You are right - thank you very much! I couldn't find the info in my bash man page yet. Nevertheless, this is a stupid behaviour of the bash.
1,983
Posted By elbrand
Bash arithmetic issue
I found the following issue by simply increasing a variable. The ((A++)) expression returns an error, the other expressions both return 0. Does anyone know why?


script.sh:

#! /bin/bash
...
4,474
Posted By elbrand
you could simply wait, till files with the name...
you could simply wait, till files with the name pattern occur. It could be useful to add a timeout to avoid your script to wait forever...


#! /usr/bin/bash
cd...
2,426
Posted By elbrand
#!/bin/bash f=0 while [ ${f} -eq 0 ] ; do ...
#!/bin/bash
f=0
while [ ${f} -eq 0 ] ; do
for i in {1..70} ; do
read a || { f=1 ; break ; }
echo "${a}"
done
done < <(tac yourfile.txt)
1,439
Posted By elbrand
in bash: while read a ; do echo ${a//,/_} ;...
in bash:

while read a ; do echo ${a//,/_} ; done < file
1,846
Posted By elbrand
yap - this works. Thank you very much!
yap - this works. Thank you very much!
1,846
Posted By elbrand
read single chars
This reads single keystrokes and produces an output:


#! /bin/bash

while : ; do
read -s -n 1 >/dev/null 2>&1
echo ${REPLY}
done | awk '{print}'


This second one don't. Even...
1,529
Posted By elbrand
several rows
to get the columns in a variable each:


while read R1 R2 ; do
echo "${R1} ${R2}"
done < infile


or read every line into an array:


while read -a A ; do
echo "${A[0]}...
2,995
Posted By elbrand
try this
while read line ; do
flog "${line}"
done < <(sed '...filtering...' filename)
2,886
Posted By elbrand
sed
to exchange all "X" by "Y" in the lines not beginning with "a".


sed '/^a/! s/X/Y/g' file.txt
4,052
Posted By elbrand
This script handles one of your files. You may...
This script handles one of your files. You may change the rows to print out. (here: 2 and 5 -> RTP="2 5")
I assume that the number of rows is usually six and only row 5 can be empty. If not we need...
3,968
Posted By elbrand
doku
I wrote a short howto for LVM and softRAID. Perhaps it helps you:

http://www.kohnos.net/files/lvm-raid.pdf
3,871
Posted By elbrand
I forgot
I forgot to mention how to call the script:

store it in to a file, p.e. /tmp/sc.sh and make it executable:

chmod a+rx /tmp/sc.sh

call it with your directory name:

/tmp/sc.sh...
1,502
Posted By elbrand
I try to explain
#! /bin/bash

while read a b ; do # this reads your file; a contains the first row, b the rest
case "${a}" in
"Table:") T="${b}" ;; ...
3,871
Posted By elbrand
try this
#! /bin/bash

D="${1}"
TD=$(mktemp -d /tmp/XXXXXXXX)
T1=${TD}/t1.txt ; T2=${TD}/t2.txt

stat --printf ":%s: %n\n" ${D}/* > ${T1}
while read a b ; do
echo "${a}"
done < ${T1} | sort |...
1,502
Posted By elbrand
try this
#! /bin/bash

while read a b ; do
case "${a}" in
"Table:") T="${b}" ;;
*) read -a A <<<${b}
[ $((P=${#A[@]}-1)) -le 0 ] && continue
case...
5,208
Posted By elbrand
sfdisk
you can use sfdisk for this. I wrote a frontend script for it:

http://www.kohnos.net/files/strprt.tgz
Showing results 1 to 25 of 37

 
All times are GMT -4. The time now is 02:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy