Timeline for How to print own script name in mawk?
Current License: CC BY-SA 3.0
Post Revisions
19 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 10, 2015 at 22:18 | comment | added | Ed Morton |
I've been talking to various shell experts and trying to get a definitive answer on whether that's a shell or awk script and surprisingly according to POSIX the interpretation of files that begin with #! is undefined and has no specific type name. While some people refer to it as a "hash bang interpreter script" rather than a shell or awk script, the consensus seems to be that it should be considered an awk script even though the kernel (not shell) interprets the first line because awk still has to be able to parse that first line too (as a comment) and you can execute it using awk -f file.
|
|
| Sep 9, 2015 at 19:43 | comment | added | Barmar |
@EdMorton It's an awk script because it begins with #!/usr/bin/awk -f. Shell scripts begin with #!/bin/sh (or something similar).
|
|
| Sep 8, 2015 at 16:01 | vote | accept | cipper | ||
| Sep 8, 2015 at 15:58 | vote | accept | cipper | ||
| Sep 8, 2015 at 16:01 | |||||
| Sep 8, 2015 at 15:55 | comment | added | cipper |
It's an awk script if you call it by awk -f myscript.awk. However, this is unrelated to the problem in question.
|
|
| Sep 8, 2015 at 14:24 | comment | added | Ed Morton | What you have posted is a shell script, not an awk script, so it shoud be named "myscript.sh" or similar, not "myscript.awk". That fact that you are calling awk inside that shell script is completely irrelevant - you could replace awk with perl or a bunch of shell commands and the script would have the same functionality and it'd still be a shell script. | |
| Sep 8, 2015 at 14:16 | answer | added | Ed Morton | timeline score: 7 | |
| Sep 8, 2015 at 11:58 | comment | added | terdon♦ |
What makes you think mawk is default on Ubuntu? On my 15.04 VM, the default awk is gawk. While mawk is installed it is not the default.
|
|
| Sep 8, 2015 at 8:48 | history | edited | cuonglm | CC BY-SA 3.0 |
deleted 3 characters in body
|
| Sep 8, 2015 at 7:03 | history | edited | cuonglm |
edited tags
|
|
| Sep 8, 2015 at 7:01 | comment | added | cipper | I've changed the title from awk to mawk because all the solutions require gawk and don't work with general awk, and in particular with mawk which is widely used (e.g. default on Ubuntu) | |
| Sep 8, 2015 at 6:57 | history | edited | cipper | CC BY-SA 3.0 |
I've changed the title from awk to mawk because all the solutions require gawk and don't work with general awk, and in particular with mawk which is widely used (e.g. default on Ubuntu)
|
| Sep 7, 2015 at 22:18 | answer | added | fedorqui | timeline score: 4 | |
| Sep 7, 2015 at 17:39 | history | tweeted | twitter.com/#!/StackUnix/status/640942425834450944 | ||
| Sep 7, 2015 at 16:31 | answer | added | cuonglm | timeline score: 5 | |
| Sep 7, 2015 at 16:23 | answer | added | Thor | timeline score: 7 | |
| Sep 7, 2015 at 16:22 | answer | added | taliezin | timeline score: 6 | |
| Sep 7, 2015 at 15:13 | review | First posts | |||
| Sep 7, 2015 at 15:26 | |||||
| Sep 7, 2015 at 15:10 | history | asked | cipper | CC BY-SA 3.0 |