[LBo] Scripting with a gui editor??

Chris F.A. Johnson cfaj at freeshell.org
Wed Dec 20 20:05:41 CET 2006


On Wed, 20 Dec 2006, Tim wrote:
>
> I come from the gui age and while I can understand there a lot of power to be
> had from the cli sometimes I just want to be able to write a quick script in
> something like kedit but I have a couple of questions?
>
> If I use kedit then should I use

     The editor has nothing to do with it. Any editor (or even word
     processor) can create a text file. And why would it make any
     difference if you use a GUI editor or a CLI-based editor? You
     have to type the script whichever type of editor you use.

> #! /bin/sh
>
> or
>
> #! /bin/bash

     You normally don't need either.

     If your script requires bash (it's better to write a portable
     script), then you may need the shebang line. However, that in
     itself can make the script less portable. I use three systems; on
     two of them, bash is not in /bin: on one it's in /usr/local/bin,
     and the other it's in /usr/pkg/bin. The script will not run if I
     use that line.

> at the start of the script and I assume what ever I use at the start I should
> use to save it as or have I missed something??
>
> For the record I am running debian etch
>
> Tim
>
> P.S. I know I still need to chmod it to make it executable

      It's a convenience (and the right thing to do), but it's not
      absolutely necessary. You can run a script that is not executable
      by calling it as an argument to the shell, e.g.:

bash scriptname

-- 
    Chris F.A. Johnson                      <http://cfaj.freeshell.org>
    ===================================================================
    Author:
    Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)


More information about the QnA mailing list