lcat
My personal /var/log
  • Home
  • Contact
  • HackMe!

Magic Python-Bash Script

Titip. File yang sama berikut akan valid jika dibaca oleh Python maupun Bash.

UPDATE 2025-04-18: Whoa.. there's already a wiki page about this kind of stuffs, it's called [multiline shebang](https://rosettacode.org/wiki/Multiline_shebang)

```
#!/bin/env bash
_="""#"
p=com.example.app
while pkill -KILL $p; do
    true
done
while ! pkill -STOP ; do
    true
done
(sleep 3; pkill -CONT $p) &
exec python "$0" "$(pidof -s $p)"
#"""

import sys
print('Arguments:', sys.argv)
```
Created: 2025-03-27 02:39:14, Updated: 2025-04-18 04:00:24, ID: 00c19a3a-ef73-4203-990c-102258f10749