カテゴリー
FreeBSD

rsync 実行時に `tty`: Ambiguous が出る

未来の自分へのメモ

ネット越しにrsyncでファイルコピーをしたところ、

`tty`: Ambiguous

というメッセージが出てきました。別の環境では出たことが無く原因が判りませんでした。

さくっとググってもすぐには私の頭ですっきり理解できる説明が見つからず、最終的に辿り着いたのが、「`tty`: Ambiguous. — what does this mean?」でした。曰く、

It is not a strange message and csh is documented to behave that way…

The problem is that in your .cshrc you have something that tries to
execute `tty`. If you are not running the shell on a real tty then
tty will print “not a tty”. Csh expects one word in some places,
but tty is giving it back 3.

The solution is to add a pair of quotes around `tty` to make it a single
word:

だそうです。
確かにcshを使っていて、.cshrcに

switch ( `tty` )
case /dev/console:
case /dev/ttyv[0-9]:
    setenv  LC_CTYPE C
    setenv  LANG     C
    breaksw
default:
    setenv  LC_CTYPE ja_JP.UTF-8
    setenv  LANG     ja_JP.UTF-8
    breaksw
endsw

このような記述をしてました。この中の `tty`の部分をダブルクォーテーションで囲むと良いそうです。

switch ( "`tty`" )
case /dev/console:
case /dev/ttyv[0-9]:
    setenv  LC_CTYPE C
    setenv  LANG     C
    breaksw
default:
    setenv  LC_CTYPE ja_JP.UTF-8
    setenv  LANG     ja_JP.UTF-8
    breaksw
endsw

これで `tty`: Ambiguous. は出なくなりました。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です