Search Results

Search: Posts Made By: rovf
1,205
Posted By Chubler_XL
This function is quite well commented, it...
This function is quite well commented, it basically uses the tail command to print the last MAX_LENGTH ($2) lines of FILE ($1) these are stored in a temporary file (name generated by the mktmp...
2,931
Posted By bakunin
Depending on what the rest of the shell script...
Depending on what the rest of the shell script looks like (and, most prominently, WHICH SHELL YOU ARE USING - you might have considered telling us) you can do it with variable expansion. Here is a...
893
Posted By RudiC
Now, that's what I'd call taking the scenic...
Now, that's what I'd call taking the scenic route! And, it doesn't yield the desired output. What be wrong with RavinderSingh13's proposal?
951
Posted By Aia
Hi, annacreek I do not mean to offend you...
Hi, annacreek

I do not mean to offend you but I suggest you stop the sermons and place more pondering to what willing people is telling you.

I understand code but I do know what's in your head...
1,372
Posted By RudiC
Not quite. All of (( ++counter )) (( counter =...
Not quite. All of (( ++counter ))
(( counter = counter + 1 ))
let counter=counter+1 return 1 when run with counter=-1.
2,640
Posted By Don Cragun
This isn't just bash... It was in ksh before...
This isn't just bash... It was in ksh before 1988, and the latest POSIX standard says the following about the LINENO variable:

So, I guess we should also ask for the output from the command:...
867
Posted By RudiC
I'd be surprised if that "real output" is the...
I'd be surprised if that "real output" is the pipe's real output, as the second grep would eliminate all lines that don't have word2 in them, and the third equivalently. I'd expect an empty result...
968
Posted By RudiC
Effort wasn't too high:while IFS=': ' read col1...
Effort wasn't too high:while IFS=': ' read col1 col2 col3
do if TMP=$(grep -w $col1 file2)
then echo "match string"
echo $col1,$col2,$col3,${TMP#*:}
...
733
Posted By MadeInGermany
@rbatte1, I disagree a bit with your post: 1. ...
@rbatte1, I disagree a bit with your post:
1.
spaces in a string are only a problem when word splitting applies, like in command arguments, and [ is a command but [[ is NOT. Word splitting in [[ ...
674
Posted By bakunin
No problem, but PLEASE: put it here in plain text...
No problem, but PLEASE: put it here in plain text format and enclosed in CODE-tags. Looking at a graphics-file in PNG-format, which will explicitly forbid copying and pasting as a means to refer to...
991
Posted By Don Cragun
Until you answer the questions raised in post #3...
Until you answer the questions raised in post #3 in this thread, you will not get any more help.

We take cheating on homework assignments very seriously!
1,245
Posted By Don Cragun
Hi SkySmart, To avoid using any external...
Hi SkySmart,
To avoid using any external utilities with most shells written since 1985 (including bash and ksh), I would use something more like:
#!/bin/ksh
MASSIVETEXT="i am on the first line
i...
3,244
Posted By Don Cragun
The assumption is that the terminal will send its...
The assumption is that the terminal will send its entire response to your terminal query in a single burst of characters. That burst of characters will be read as one "block" by dd and with the...
3,244
Posted By apmcd47
From a 1980's script, written by somebody else...
From a 1980's script, written by somebody else for Suns:

stty raw >/dev/tty
echo -n "$report" >/dev/tty
ch=`dd </dev/tty count=1 2>/dev/null`
stty cooked >/dev/tty

Where $report is your...
5,630
Posted By Scrutinizer
In zsh try $'\t' instead of double quotes...
In zsh try
$'\t' instead of double quotes (which also works in bash).


--
@Scott, that is because of the echo statement. With printf it will print "\t"
3,116
Posted By RudiC
@rbatte1: while your proposal will work fine in...
@rbatte1: while your proposal will work fine in an empty directory, if you're expecting one single matching file, it will fail should there be more than one. Which is not too far fetched according to...
4,663
Posted By MadeInGermany
Also paste reads the input files (here: the ls...
Also paste reads the input files (here: the ls commands) in round robin order:
paste -d '\n' <( ls A/ ) <( ls B/ ) <( ls C/ )
Empty lines might occur if an input file is exhausted; you can discard...
4,330
Posted By RudiC
In (recent!) bash, try also shopt -s extglob ...
In (recent!) bash, try also
shopt -s extglob
ls !(*.*).dat
2,517
Posted By giuinha
Read in txt file and run a different command for each line
hi,

i'm trying to write a tcsh script that reads in a text file (one column) and the runs a different command for each line of text.

i've found lots of example commands for bash, but not for...
2,608
Posted By Don Cragun
Hi rovf, If, and only if, there is a file named...
Hi rovf,
If, and only if, there is a file named 127.0.0.1 in the directory in which you invoke the command:
./script.ksh 127[.]0[.]0[.]1
then the shell would start script.ksh with $1 set to...
2,451
Posted By Scrutinizer
local is the same as typeset and it is a...
local is the same as typeset and it is a declaration. Set is an assignment to the array. To use associative arrays, typeset (declaration) must be done beforehand.. With regular arrays declaration is...
3,469
Posted By Corona688
So this takes a single $op, such as "-z", and a...
So this takes a single $op, such as "-z", and a single $arg, which is supposed to be a literal value? Feed them into the test external to test them outside the shell:

if test "$op" "$arg"
then...
1,141
Posted By MadeInGermany
for pat cycles through $1 $2 ... just like for...
for pat cycles through $1 $2 ...
just like for pat in "$@"
15,165
Posted By drl
Hi. For the install of GNU diff, it looks...
Hi.

For the install of GNU diff, it looks like there are also dependencies to be installed:

gettext libiconv libunistring make
http://hpux.connect.org.uk/hppd/hpux/Gnu/diffutils-3.3/
Best...
759
Posted By RudiC
A similar thing is possible in (recent) bash with...
A similar thing is possible in (recent) bash with the extglob option set:
shopt -s extglob
for DIR in !(AL|LA)/; do echo $DIR; done should list ALL directories except AL and LA.
Showing results 1 to 25 of 40

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