Re: [patch] new special variable: test argument

2015-12-18 Thread Piotr Grzybowski
Thanks for taking time to answer. Of course it is the issue of programming style (isnt it true that most things can be brought down to the programming style?), two real-life examples (stripped-down of everything): #1 if [ -f ${output}/${branch}/${index}/${current} ]; then let current--; for((i=

Re: [patch] new special variable: test argument

2015-12-18 Thread Piotr Grzybowski
Dear Stephane, thanks. On Wed, Dec 16, 2015 at 7:36 PM, Stephane Chazelas wrote: > What's wrong with > > f=/tmp/myfile; [ -f "$f" ] && { echo "$f is here"; head -n 1 < "$f"; } nothing. sometimes it is just not practical (see my answer to Chet's comment) and sometimes you just want to get that

Re: [patch] new special variable: test argument

2015-12-18 Thread Piotr Grzybowski
On Wed, Dec 16, 2015 at 8:44 PM, konsolebox wrote: > > Just my quick thoughts: > > Pros: > 1) It could make code smaller. > 2) It could make writing code less prone to typos. > 3) It could make writing code faster. thanks. that was exactly the idea behind it. > Cons: > 1) The constant assignmen

count

2015-12-18 Thread Krem
Hi all, I have one folder and this folder contains several folders. Each sub folders contains 5 or 6 files. So i want count the number of rows within each file and produce an output. Assume the main folder called A and it has three subfolders folder1, folder2 and folder3. Folder1 has

Re: [patch] new special variable: test argument

2015-12-18 Thread Stephane Chazelas
2015-12-19 00:58:41 +0100, Piotr Grzybowski: > Thanks for taking time to answer. Of course it is the issue of > programming style (isnt it true that most things can be brought down > to the programming style?), two real-life examples (stripped-down of > everything): > > #1 > if [ -f ${output}/${b