Third, $1 isn't a command name so you can't pipe into it. Pipes are for commands, files use redirection.
Fourth, this doesn't work in general. It's only working here because of special properties of the sort command: It reads the entire file before writing any output, hence reads the entire file before uniq is allowed to truncate it. This will NOT work:
So in general, redirecting to the same file you're reading from is a bad idea. It only works in very special circumstances.
the shell reads the command line, substitutes parameters
then it will spot the redirect which says
"truncate the file and send ouput to it".
so it truncates the file.
only then does it run the command, but by then the
file's been trashed.
#!/bin/bash
source=/to_be_archived
dest=/archived
echo "is this archive for an audio tar press (t) or an audio directory press (d)"
read option
case $option in
d)
cd "$source"
echo "please specify full path to directory you want to be... (6 Replies)
Hi,
I want to start MY_PROGRAM in a bash script with additional parameters given in the CONFIGURATION_ARRAY.
IFS="'"
CONFIGURATION_ARRAY=( '-N 0 -m 0' '-N 0 -m 1' )
for configuration in ${CONFIGURATION_ARRAY}
do
//DEBUG
N=${configuration%-*} //-N 0
M=-${configuration##*-} //-m 0... (5 Replies)
Hi there can anyone help me to spot my mistake and please explain why it appears
My code :
#!/usr/bin/gawk -f
BEGIN { bytes =0}
{ temp=$(grep "datafeed\.php" | cut -d" " -f8)
bytes += temp}
END { printf "Number of bytes: %d\n", bytes }
when I am running ./q411 an411
an411:
... (6 Replies)
Hi everyone !
I have a file wich look like this :
>Sis01
> Sis02
...
>Sis44
I want to separe each paragraphe in a different file, so I decide to use the "FOR" loop + sed.
for f in {01..44}
do (5 Replies)
hi,
instead of typing crontab -e i gave crontab -r and hit enter. So i lost all my scripts.
Is there any way to restore the deleted scripts?
Please help me out
Thanks
Ajay (3 Replies)
Let's say someone accidentally renamed the lib directory in Solaris 8, and now they cannot get into the terminal or even rename the folder via file manager.What would one do? (37 Replies)
Hi there,
Can anyone help me find the correct expression for sed.
I want to repace iface eth0 inet wathever
with iface eth0 inet static
Thanks for your help
Santiago (5 Replies)
Hi,
I needed space on a FS, and when I've added the space on the filesystem, I did it trough the regular smitty fs inteface and not with smitty cl_lvm.
Can someone help me to repair the situat before a faileover happen ?
Thanks for your help,:mad: (13 Replies)
Hi. I hope someone can help me with this problem.
Being a novice to Unix, I editted my crontab directly
by typing " crontab -e ". Well, I needed to make some
changes so, I typed " crontab -r ". Now I have no crontab,
and I can't seem to get crontab to write a new file.
I' ve tried:
vi... (4 Replies)