9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
This returns 0 even when it does not delete any files.
Is it because -print returns 0?
RETVAL=$?
Docs_Backups=/media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/Documents_Backups/
Scripts_Backups=/media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/Script_Backups/
# create some old files
#touch -d 20120101... (4 Replies)
Discussion started by: drew77
4 Replies
2. Shell Programming and Scripting
Hi,
I need to return a value from the function. the value will be the output from cat command which uses random fucntion.
#!/bin/ksh
hello()
{
var1=$(`cat /dev/urandom| tr -dc 'a-zA-Z0-9-!%&()*+,-/:;<=>?_'|fold -w 10 | head -n 1`)
echo "value is" var1
return var1
}
hello
var=$?... (2 Replies)
Discussion started by: Nandy
2 Replies
3. Shell Programming and Scripting
Hi all. I am trying to compare and filter two files. I have a bigfile.txt of names and ids and a smallfile.txt of ids only. What I am trying to do is use a while read loop to read the ids in the bigfile and then echo the name and id only if the id exists in the small file. Basically, I'm trying to... (5 Replies)
Discussion started by: jameswatson3
5 Replies
4. UNIX for Dummies Questions & Answers
I get an error when I grep my results into a variable when the grep finds more than one file.
FND="$(find ediout* -mmin -60)"
if ; then
STR="$(find ediout* -mmin -60 -exec grep -l "ERRORS Encountered" {} +)"
fi
When there is only one ediout file it works fine. How do I... (11 Replies)
Discussion started by: aispg8
11 Replies
5. Shell Programming and Scripting
I’m trying to modify someone perl script to fix a bug. The piece of code checks that the zone name you want to add is unique. However, when the code runs, it finds a partial match using grep, and decides it already exists, so the “create” command exits.
$cstatus = `${ZADM} list -vic | grep... (3 Replies)
Discussion started by: TKD
3 Replies
6. Shell Programming and Scripting
my intension is to use a grep command inside the shell script
and if any row is returned or not..
depending on the resultset i have to code on further.
how to check this
i mean.. could anyone help me out with the if condition how to use it here !! (4 Replies)
Discussion started by: gotam
4 Replies
7. Shell Programming and Scripting
Hi all!
I've faced with very unintelligible error using find/grep like this:
root@v29221:~# find /var/www/igor/data/www/lestnitsa.ru | grep u28507I get nothing as a result, but:
root@v29221:~# grep u28507 /var/www/igor/data/www/lestnitsa.ru/_var.inc
$db_name = 'u28507';... (2 Replies)
Discussion started by: ulrith
2 Replies
8. UNIX for Dummies Questions & Answers
Is there a command where I can pipe my grep into it and it will output it with spaces rather than returns?
Example
I want to turn
prompt$ grep blah file
blah
blah
into this
prompt$ grep blah file | someCommand
blah blah (1 Reply)
Discussion started by: mrwatkin
1 Replies
9. Programming
Im trying to connect to a particular IP address and I'm tying to use gethostbyaddr() and inet_addr() to do this. However, when I tried using inet_addr(), I always get a return value of 0 when I tried to connect to "172.21.16.238". Hope someone here could help me on this. I already tried using inet_... (1 Reply)
Discussion started by: soulfactory2002
1 Replies