Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dtmilano/shebang
https://github.com/dtmilano/shebang
Last synced: 28 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dtmilano/shebang
- Owner: dtmilano
- License: gpl-2.0
- Created: 2013-04-18T21:02:39.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-04-30T17:44:06.000Z (over 11 years ago)
- Last Synced: 2023-03-12T06:01:46.271Z (over 1 year ago)
- Language: C
- Size: 203 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: ChangeLog
- License: COPYING
Awesome Lists containing this project
README
shebang 0.3
~~~~~~~~~~~From the Jargon Dictionary:
http://info.astrian.net/jargon/terms/s/shebang.htmlshebang /sh*-bang/ n.
The character sequence "#!" that frequently begins executable shell scripts
under Unix. Probably derived from "shell bang" under the influence of American
slang "the whole shebang" (everything, the works).Shebang permits that programs that accept scripts but don't allow '#' as a
comment, be used with shebang (#!) interpreter method of execution.
This is because the entire script is passed to the interpreter untouched,
including the first (shebang) line. If '#' is not understood as a comment,
probably you get a 'syntax error' from the interpreter.Now you can write scripts that will be executed by those programs with no
conflict.examples
~~~~~~~~
#! /usr/local/bin/shebang --cmd cat
Hello $1Save this a test1.
This trivial example shows the shebang use.
Running 'test1' you will get 'Hello' and running 'test1 Donald'
'Hello Donald'.#! /usr/local/bin/shebang --cmd 'cat /etc/HOSTNAME -' --checkargs 1 --usage "test2 name"
Hello $1saving this script as 'test2' and invoking
$ test2 Donald
the output will be
zebra.in3.arg
Hello Donaldthis was a trivial example only to show the syntax.
You can find more interesting ones in the tests directory of this distribution.informix dbaccess
~~~~~~~~~~~~~~~~~
dbaccess is one of those programs that cannot be used in scripts, as the
interpreter because '#' is not a valid comment character in Informix SQL.
If you try this (don't forget to change INFORMIXDIR value):#! /opt/informix-9.20IIF/bin/dbaccess sysmaster
select tabid,tabname from systables;you will receive this error
Database selected.
802: Cannot open file for run.
Database closed.
that's because dbaccess cannot be used in that way.
But if you replace the first line to (the "'" are very important)#! /usr/local/bin/shebang --cmd '/opt/informix-9.20IIF/bin/dbaccess sysmaster'
select tabid,tabname from systables;this output will be generated
Database selected.
tabid 1
tabname systablestabid 2
tabname syscolumns[...]
This is the method to write SQL scripts.