10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
The below command works in the terminal interactively but not as part of a bash script. I though maybe I needed to escape the "$dir" so it isn't interpreted literally, but that's not it. Thank you :).
interactively in terminal
dir=/path/to
new=$(ls "$dir"/*.csv -tr | tail -n 1) && echo... (6 Replies)
Discussion started by: cmccabe
6 Replies
2. Shell Programming and Scripting
Hello.
I'm new to bash script and I'm learning the basics by writing some scripts.
Recently a friend of mine asked me if I could try to write a script to him to automate a couple of processes that uses JSON RPCs.
I'll try to explain in few words the workflow just to contextualize the problem.... (48 Replies)
Discussion started by: psysc0rpi0n
48 Replies
3. Shell Programming and Scripting
I need to be able to use a sed command as a variable in a bash script. I have the sed command that almost works the way I want it. the command is
sed -n '/inet/,/}/p' config.boot
This gets me this result:
inet 192.168.1.245
}
I need to get the IP address into a variable so I... (9 Replies)
Discussion started by: edlentz
9 Replies
4. Shell Programming and Scripting
Hello im new here... Im trying to read file and create folders from words in it but i get this for loop error
awk : line 3 : syntax error at or near for
my code is..
#!/bin/bash
begin
for (( i=1;i<=5;i++));
do
awk -v i=$i $0 { print $i }
mkdir $i
done
{print $i}
end {}
i have... (7 Replies)
Discussion started by: boxstep
7 Replies
5. Shell Programming and Scripting
Hello,
i have bash script where im cycling some command for different lines in external file.
example:
while read domain;do
nslookupout=$(nslookup -type=ns $domain) || true
another commands
done < filenamewithdomains
i added:
|| true
after the command in belief it will just skip... (6 Replies)
Discussion started by: postcd
6 Replies
6. Shell Programming and Scripting
Hi,
Will following set up work in bash script? I've got errors if assigning following binary command to a variable. But on the other hand, COMMAND="ls" works. Any explanation please? How can I assign binary command to a variable COMMAND then I can just call ${COMMAND}?
COMMAND="rsync"... (3 Replies)
Discussion started by: hce
3 Replies
7. Shell Programming and Scripting
In a bash script, one can call a perl command in the following manner, where "myperlcommand" is a perl command.
perl -e 'myperlcommand(arguments)'
perl -e 'print("UUUU"x4)'
Now, how can one call a bash command from within a perl script? (Suppose that mybashcommand is a bash... (1 Reply)
Discussion started by: LessNux
1 Replies
8. Shell Programming and Scripting
Hi,
I have tried several times but failed, I need to call this script from the perl script. This one line script will be sent to /var/tmp/error
Bash command:
/usr/openv/netbackup/bin/admincmd/bperror -backstat -l -hoursago 12 |awk '{ print $19, $12, $14, $16}'|grep -vi default|sort >... (12 Replies)
Discussion started by: sQew
12 Replies
9. Shell Programming and Scripting
Hi all. I am using procmail to deliver an email to a script I am developing. Procmail delivers the email to the script on standard input. I imagine this is the same as piping input from a command into the script. Hence I've been testing my script by running
echo 'test' | sms-autosend-backup.sh
... (2 Replies)
Discussion started by: akindo
2 Replies
10. UNIX for Dummies Questions & Answers
Hello everyone,
I am struggling a bit with a batch script that I need to run in cygwin. I work in winXP and I had to write some awk scripts to do some file manipulation, and now I would like to automate the process by just running a batch file so that my colleagues can use it easily.
Now, the... (2 Replies)
Discussion started by: Teroc
2 Replies