[ale] Bash scripting and printf
ari
myo at thy.dyn.ml.org
Mon Sep 14 12:38:07 EDT 1998
are you familiar with C?
its format is similar to C's printf.
in C:
char name[] = "joe";
int num = 5;
printf("herro dere %s\n", name);
printf("the number is %d\n", num);
in SH (and BASH):
export name="joe"
export num=5
printf "herro dere %s\n" $name
printf "the number is %d\n" $num
and so on.
ari
Bob Kruger (bkruger at mindspring.com) said this stuff:
> At 10:00 AM 9/14/98 -0400, you wrote:
> >Thus spake Bob Kruger (bkruger at mindspring.com):
> >
> >>
> >>
> >> Does anyone have any experience with bash scripting and bash printf?
> >>
> >> I have a number for bash scripts that I don't want to take the time to
> >> convert to Perl, but would like to clear up the format a bit. I noticed
> >> from the bash man that printf is supported by bash, but the docs were
> >> sketchy on the format and use.
> >>
> >> Any help would be greatly appreciated.
> >
> >There are some examples of printf in scripts in _Beginning Linux
> >Programming_ from Wrox Publishers. Chapter 2.
>
> Thank you.
>
> Without the need of going out and buying another book, does anyone have any
> examples that they would be willing to share?
>
> Bob
More information about the Ale
mailing list