Search Results

Search: Posts Made By: Riker1204
4,218
Posted By Corona688
It's not about order of evaluation, it's about...
It's not about order of evaluation, it's about your filenames being mangled from passing them through a pointless pipe chain then cramming them into read -d "\0". The -d "\0" is especially pointless...
4,218
Posted By Corona688
Actually, how about this? grep -Hc "dn: "...
Actually, how about this?

grep -Hc "dn: " /localbackup/ldap/* Will output file1:count
file2:count
fle3:count
... All in one efficient command.
4,218
Posted By RudiC
I'm afraid I don't understand the problem, except...
I'm afraid I don't understand the problem, except that your code is utmost cumbersome. Why do you use the read -a at all? Why the complicated "command substitution"? The -rlt options to ls?...
4,218
Posted By Corona688
I just encountered this behavior yesterday. ls...
I just encountered this behavior yesterday. ls on Linux now injects single quotes around filenames with spaces in them, for your convenience! Ugh! Eval or xargs would swallow those, anything else...
1,143
Posted By Chubler_XL
In bash you could have process substitution...
In bash you could have process substitution manage a named pipe for you. Below I duplicate this with exec onto file descriptor 7.

You can then simply read and discard from this file descriptor...
1,143
Posted By Aia
#!/bin/bash program > program.log 2>&1 & ...
#!/bin/bash
program > program.log 2>&1 &
pid=$!
for s in {1..15}
do
sleep 1
done
kill $pid
Forum: Programming 10-12-2016
3,093
Posted By disedorgue
You have another error: closure of first if is...
You have another error: closure of first if is after last else and not before:
Your code corrected:
#include <stdio.h>

main() {

int c, i, state, wl;
int maxlength[15];

...
Forum: Programming 10-12-2016
3,093
Posted By Corona688
You are getting into the if(c == '\n') section...
You are getting into the if(c == '\n') section with state as still OUT and thereby bypassing your ++maxlength[wl].

I don't think state serves any function at all though. You could dispose of it...
Forum: Programming 10-12-2016
3,093
Posted By disedorgue
Hi, Already, you have typo: ...
Hi,
Already, you have typo:
else if (state == IN) {
state == OUT;
++maxlength[wl];
wl = 0;
Regards.
4,012
Posted By MadeInGermany
No, there is always one more fields than...
No, there is always one more fields than delimiters.
Between consecutive delimiters there is an empty field.
4,012
Posted By Aia
As a side note, if you want to know the mac...
As a side note, if you want to know the mac assigned to an interface, in a Linux system just read it from /sys:
cat /sys/class/net/eth0/address
Much faster.
4,012
Posted By Scrutinizer
Yes, with cut every occurrence of the delimiter...
Yes, with cut every occurrence of the delimiter separates a field.


--
The default delimiter in awk does not. Try:
ifconfig eth0 | awk '/HWaddr/{print $5}'
7,001
Posted By Don Cragun
The correct syntax with test expr and [ expr ]...
The correct syntax with test expr and [ expr ] for expressions performing numeric comparisons is -lt, -le, -eq, -ne, -gt, or -ge and for string comparisons is = and !=.

With [[ expr ]], the...
7,001
Posted By Don Cragun
It isn't immediately obvious to me why bash...
It isn't immediately obvious to me why bash complains about your provided code. (But, I usually use ksh instead of bash.) A recent ksh runs it without complaining.

Both bash and ksh are happy...
1,423
Posted By sea
Yes, it assigns the string 'Stuff' to variable...
Yes, it assigns the string 'Stuff' to variable 'Var'.
Wether 'Var' contains a string "Stuff" or the filename (also a string) "Stuff" is no diffrence at all.

It neither points to the file, nor...
Showing results 1 to 15 of 15

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