cdepillabout / cdepillabout/shebanger
The Challenge
- Dominant language
- Haskell
- Stars
- 17
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
`shebanger` has one big problem (other than being completely useless...):
`shebanger` outputs a series of scripts that look like the following:
```console
$ cat ./test.sh.shebanged.3
#!/usr/bin/env -S shebanger exec bnQgbnVtYmVycyBmcm9tIDEgdG8gMTAKZm9yIGkgaW4gYHNlcSAxIDEwYCA7IGRvCiA=
```
You can see that this script is calling the `shebanger` executable in order to reconstruct the input script and run it. However, this means that **`shebanger` must be available on the system where the scripts are being run**.
It would be a big improvement if `shebanger` output a series of scripts consisting only of a shebang line, but that _don't_ require the `shebanger` executable to be available on the system where the scripts will be run.
----------------------------------------------------------------------------------------
Here's a programming challenge that I think would be interesting:
1. Write a program like `shebanger` that takes a shell script (or, ideally any executable file) as input, and outputs a series of executable files that consist entirely of shebang lines. So each output file must only contain a single line, and it must start with `#!`. (In fact it should probably start with `#!/usr/bin/env -S ...`)
2. The output "shebanged" files are _only_ allowed to use a single interpreter, like `bash`, `python`, `perl`, etc. This means the shebang line will probably look like `#!/usr/bin/env -S bash -c 'echo hello; ...'`, or `#!/usr/bin/env -S python -c 'print("hello"); ...'`, etc.
3. The output shebanged files are _not_ allowed to read and write other files on disk. Each "shebanged" file is only allowed to `exec()` the next in the series of shebanged files.
4. The contents of the input shell script will have to be encoded into the shebang lines of the output files. After executing the last output shebanged file, it should have completely reconstructed the input script, so it should execute it. It should execute exactly the same as if you had run it on its own.
Keep in mind that shebang lines are limited to 127 characters are some systems, so your solution should make sure to adhere to this limit.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the existing shebanger CLI and its current output behavior, using the sample ./test.sh.shebanged.3 as the reference. The implementation must produce a chain of files containing only shebang lines, avoid filesystem reads and writes, preserve execution of the input script, and keep every shebang within the 127-character limit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell, shell
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100