Help us understand the problem. What is going on with this article?

tclスクリプトをコマンドラインから実行する

環境

$tclsh
% info tclversion
8.5

いけたやつ

tclsh -e cat <<EOS
puts "hello wolrd"
EOS
$tclsh -e cat <<EOS
> puts "hello wolrd"
> EOS
hello wolrd

いけなかったやつ

-eオプションが必要ぽい。

tclsh cat <<EOS
puts "hello tcl"
EOS
$tclsh cat <<EOS
> puts "hello tcl"
> EOS
couldn't read file "cat": no such file or directory

プロセス置換だと、インタプリタ起動してしまう。

tclsh -e <(cat <<EOS
puts "hello wolrd"
EOS
)
$tclsh -e <(cat <<EOS
> puts "hello wolrd"
> EOS
> )
% puts "yahoo!"
yahoo!

おまけ

これで、標準入力からの入力行を受け取れた。

seq 3 | xargs -t -I@ bash -c 'tclsh -e cat <<EOS
puts "@"
EOS
'

-tオプションでデバッグ出力。

$seq 3 | xargs -t -I@ bash -c 'tclsh -e cat <<EOS
puts "@"
EOS
'
bash -c tclsh -e cat <<EOS
puts "1"
EOS

1
bash -c tclsh -e cat <<EOS
puts "2"
EOS

2
bash -c tclsh -e cat <<EOS
puts "3"
EOS

3

デバッグ出力なし。

$seq 3 | xargs -I@ bash -c 'tclsh -e cat <<EOS
puts "@"
EOS
'
1
2
3
ukijumotahaneniarukenia
sqlが大好き。(oracle) WordPressはじめました。sql oracleやそれ以外について調べたこととか記していきます。 https://github.com/ukijumotahaneniarukenia
https://ukijumotahaneniarukenia.site/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした