Skip to main content
Removed comment about entering the file name in the shell. This is irrelevant. Accepting the byte count correction.
Source Link
ugoren
  • 17.5k
  • 1
  • 15
  • 16

Using the program name to store data without counting those bytes

Example - this bash script prints Hello World!

echo $0

Must be saved in a file called Hello World! (entered on the shell command line as 'Hello World!' or Hello\ World!).


When using the filename to store data, add them as extra bytes to your solution similarly to any non-standard parameter.

For example the correct byte count for the above is 7 (echo $0) + 12 (Hello World!) = 19 bytes.

Using the program name to store data without counting those bytes

Example - this bash script prints Hello World!

echo $0

Must be saved in a file called Hello World! (entered on the shell command line as 'Hello World!' or Hello\ World!).


When using the filename to store data, add them as extra bytes to your solution similarly to any non-standard parameter.

For example the correct byte count for the above is 7 (echo $0) + 12 (Hello World!) = 19 bytes.

Using the program name to store data without counting those bytes

Example - this bash script prints Hello World!

echo $0

Must be saved in a file called Hello World!.


When using the filename to store data, add them as extra bytes to your solution similarly to any non-standard parameter.

For example the correct byte count for the above is 7 (echo $0) + 12 (Hello World!) = 19 bytes.

If the file name contains the backslash, it will get printed. How to enter the filename for the shell is not the same as the filename itself. See comment
Source Link

Using the program name to store data without counting those bytes

Example - this bash script prints Hello World!

echo $0

Must be saved in a file called Hello World\World! (entered on the shell command line as 'Hello World!' or Hello\ World!).


When using the filename to store data, add them as extra bytes to your solution similarly to any non-standard parameter.

For example the correct byte count for the above is 7 (echo $0) + 1312 (Hello World\World!) = 2019 bytes.

Using the program name to store data without counting those bytes

Example - this bash script prints Hello World!

echo $0

Must be saved in a file called Hello World\!


When using the filename to store data, add them as extra bytes to your solution similarly to any non-standard parameter.

For example the correct byte count for the above is 7 (echo $0) + 13 (Hello World\!) = 20 bytes.

Using the program name to store data without counting those bytes

Example - this bash script prints Hello World!

echo $0

Must be saved in a file called Hello World! (entered on the shell command line as 'Hello World!' or Hello\ World!).


When using the filename to store data, add them as extra bytes to your solution similarly to any non-standard parameter.

For example the correct byte count for the above is 7 (echo $0) + 12 (Hello World!) = 19 bytes.

bash isn't really code
Source Link
MD XF
  • 13.9k
  • 17
  • 19

Using the program name to store data without counting those bytes

Example - this bashbash script prints Hello World!

echo $0

Must be saved in a file called Hello World\!


When using the filename to store data, add them as extra bytes to your solution similarly to any non-standard parameter.

For example the correct byte count for the above is 7 (echo $0) + 13 (Hello World\!) = 20 bytes.

Using the program name to store data without counting those bytes

Example - this bash script prints Hello World!

echo $0

Must be saved in a file called Hello World\!


When using the filename to store data, add them as extra bytes to your solution similarly to any non-standard parameter.

For example the correct byte count for the above is 7 (echo $0) + 13 (Hello World\!) = 20 bytes.

Using the program name to store data without counting those bytes

Example - this bash script prints Hello World!

echo $0

Must be saved in a file called Hello World\!


When using the filename to store data, add them as extra bytes to your solution similarly to any non-standard parameter.

For example the correct byte count for the above is 7 (echo $0) + 13 (Hello World\!) = 20 bytes.

Explained a bit more
Source Link
SztupY
  • 3.9k
  • 12
  • 11
Loading
Filename as data is fine, the only problem is not counting it. (The comment describing this has 2x the upvotes of this answer). Also properly golf the filename: word-splitting is fine because echo prints args space-separated. Still probably need to escape the ! for history expansion.
Source Link
Loading
Post Made Community Wiki by C. K. YoungMod
Remove Gratuitous Capitalization, fix typo
Source Link
Ilmari Karonen
  • 20.8k
  • 2
  • 19
  • 29
Loading
Source Link
ugoren
  • 17.5k
  • 1
  • 15
  • 16
Loading