KarrottoP
01-19-2005, 12:02 PM
I have written some cheesy bash scripts but nothing that involved variables and functions and all that stuff. What I am trying to acomplish is a bit more interesting (and I do have a bash book on the way).
I need this to save the output of the program faxstat to a file
#faxstat > /faxstatfile
then to evaluate the length of the file
#wc -c /faxstatfile
then run an if statement something like
"if the output of 'wc -c /faxstatfile' = "75 /faxstatfile' then "echo 'yes' " else exit.
This is simplified to what the function would be but I figured it would be a good way to get information on the functions I am trying to create here is my code that does not work:
#!/bin/bash
faxstat > /statfile
statsize ()
{
wc -c /statfile
}
if statsize = "75 /statfile"
then
{
echo "yes"
}
fi
Any help would be appreciated I am making a newbie out of myself with this bash scripting stuff.
Thanks.
I need this to save the output of the program faxstat to a file
#faxstat > /faxstatfile
then to evaluate the length of the file
#wc -c /faxstatfile
then run an if statement something like
"if the output of 'wc -c /faxstatfile' = "75 /faxstatfile' then "echo 'yes' " else exit.
This is simplified to what the function would be but I figured it would be a good way to get information on the functions I am trying to create here is my code that does not work:
#!/bin/bash
faxstat > /statfile
statsize ()
{
wc -c /statfile
}
if statsize = "75 /statfile"
then
{
echo "yes"
}
fi
Any help would be appreciated I am making a newbie out of myself with this bash scripting stuff.
Thanks.