Re: Naming convention of bash script filenames

2010-07-11 Thread Chris F.A. Johnson
On Sun, 11 Jul 2010, Peng Yu wrote:

> Hi,
> 
> I think that that may not be a unique naming convention for bash
> script filenames. But I use the following.
> 
> For an executable bash script I use the suffix .sh. For a bash script
> that is only source-able but runnable, I use the suffix .bashrc.
> 
> People may use different conventions. I just want to see what most
> people use and follow the common practice. Could anybody give me any
> suggestions?

   Like Bob, and for the same reasons, I do not use any suffix for a
   script once it is completed.

   I do, however, use a suffix when I'm working on a script: -sh

   I do my development on the -sh version, then copy that to the bin
   directory, without the suffix, when I've finished.

   That way, I can test the script with -sh, and continue working on
   it, without affecting the production copy.

   (The support scripts for this are in the last chapter of my first
   book, Shell Scripting Recipes".)

-- 
   Chris F.A. Johnson, 
   Author:
   Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)



Re: Naming convention of bash script filenames

2010-07-11 Thread Bob Proulx
Peng Yu wrote:
> For an executable bash script I use the suffix .sh. For a bash script
> that is only source-able but runnable, I use the suffix .bashrc.
> 
> People may use different conventions. I just want to see what most
> people use and follow the common practice. Could anybody give me any
> suggestions?

For an executable script I use no suffix at all.  It matters not if
the script is a bash script, sh, ksh, perl, ruby, or whatever.  The
caller shouldn't care.  Something I start off writing as a shell
script may over the course of time get refactored into a perl or ruby
script.  Or a perl script written by other people may really be
nothing more than a command launcher in which case I have often
refactored it into a simple shell script.  Many of the programs in
/bin and /usr/bin have been shell scripts or compiled executables at
different stages in their lifetimes and it did not matter to the
callers as long as the interface remained stable.

Bob



Naming convention of bash script filenames

2010-07-11 Thread Peng Yu
Hi,

I think that that may not be a unique naming convention for bash
script filenames. But I use the following.

For an executable bash script I use the suffix .sh. For a bash script
that is only source-able but runnable, I use the suffix .bashrc.

People may use different conventions. I just want to see what most
people use and follow the common practice. Could anybody give me any
suggestions?

-- 
Regards,
Peng



Re: Set of characters that are treated specially between a pair of double quotes?

2010-07-11 Thread John Reiser
> Could anybody let me know the complete set of characters that need to
> be escaped (prepend with backslash) between a pair of double quotes if
> I really want to print the character?

RTFM.  In particular, the manual page ("man bash") has a succinct section
entitled "QUOTING".

-- 



Set of characters that are treated specially between a pair of double quotes?

2010-07-11 Thread Peng Yu
For the character $ is treated specially between a pair of double quotes.

echo "$PATH"

If I really want to print $, I need to say

echo "\$PATH"

Could anybody let me know the complete set of characters that need to
be escaped (prepend with backslash) between a pair of double quotes if
I really want to print the character?

-- 
Regards,
Peng