Re: How to use apostrophe in bash shell script?
nate wrote:
> Kent West said:
> > I'm trying to use the following in a bash shell script:
> >
> > echo This machine's name and IP address
> > cat /etc/hosts | grep $HOSTNAME
>
> try enclosing the line in quotes:
>
> echo "This machine's IP address"
>
> seems to work for me
>
> nate
>
Thanks for the response.
Both your suggestion and my original line (see above) work from the command
line, but neither work from the shell script. So, I created a new, minimal shell
script (below) which does work. So it must be something in my script. I'll take
a closer look. Thanks for the help!
Contents of script which does work:
---------------------
#!/bin/bash
echo "This machine's name"
Kent
Reply to: