2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

スクリプト言語を bash スクリプトに埋め込むためのメモ

Last updated at Posted at 2016-12-09

20161209

perl での知識が流用出来たからメモっとく。

Python は 2系を例にしてる

function として

#!/bin/bash
function py () {
    python -- <<'EOF' - "$@"
import sys
print sys.argv[1]
EOF

}

function ru () {
    ruby -- <<'EOF' - "$@"
    puts ARGV[0]
EOF
}

py python
ru ruby

ついでに、パイプで渡して

$ echo python | python -c '
import sys

for i in sys.stdin:
    print i,
'
$ echo python | python -c 'print raw_input()'

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?