Lars Wirzenius on Nostr: Sometimes, not often, it really helps me debug complicated shell scripts and other ...
Sometimes, not often, it really helps me debug complicated shell scripts and other things to see what the actual contents of the argv array of a program I'm trying to run is. I wrote a little Python script for this years ago, called print-argv. I just prints out the contents of the argv array.
$ print-argv echo hello world
[0]: /usr/bin/print-argv
[1]: echo
[2]: hello
[3]: world
The script core is:
for i, arg in enumerate(sys.argv):
sys.stdout.write("[%d]: %s\n" % (i, arg))
Published at
2024-08-26 06:50:16Event JSON
{
"id": "ff036829b3995f187b8e471a722d4ed26e5e2cffb1a7e7d0cf9c96834f177e64",
"pubkey": "b10dc1f389e232d431638f9ab5e479818b1bfab197d62e420c170baf0bec09cb",
"created_at": 1724655016,
"kind": 1,
"tags": [
[
"proxy",
"https://toot.liw.fi/users/liw/statuses/113026991130974269",
"activitypub"
]
],
"content": "Sometimes, not often, it really helps me debug complicated shell scripts and other things to see what the actual contents of the argv array of a program I'm trying to run is. I wrote a little Python script for this years ago, called print-argv. I just prints out the contents of the argv array.\n\n$ print-argv echo hello world\n[0]: /usr/bin/print-argv\n[1]: echo\n[2]: hello\n[3]: world\n\nThe script core is:\n\nfor i, arg in enumerate(sys.argv):\n sys.stdout.write(\"[%d]: %s\\n\" % (i, arg))",
"sig": "54ca22f50ea555363914bc5d99ad15771136c2ffe4e466c9f70c89523e242da4a0c50da2a9c7531bb619c49a28e3930b0b7b9707a3d1587a28223b6816c035f9"
}