Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bourne Shell Variable Assignment 1

Status
Not open for further replies.

Michael42

Programmer
Oct 8, 2001
1,454
US
Hello,

In using the Bourne shell on a Solaris 8 system I was never really sure if I needed to place a string variables in quotes as if there a no spaces it always seems to work for me. :)

These work identically for me:
Code:
FILE=/mypath/myfile.txt

Code:
FILE="/mypath/myfile.txt"

If there are no spaces are there any good reasons to use quotes on string variable assignment in Bourne shell scripts?

Thanks,

Michael42
 
No, there's no need. However there was another discussion in this forum pointing out that scripts run more efficiently if constants are surrounded in single quotes as the shell doesn't attempt to evaluate them for variables, etc. I wouldn't lose any sleep over it! :)

Annihilannic.
 
>> No, there's no need.

Thanks for confirming sir.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top