2016-09-06 17 views
0

tcshでファイル構造のマッピングを行いたいとします。考える は、物理的なフォルダで、構造1である、と言う:tcsh:ls vs pwd vs cd

/map/horse/dog/mouse ; mouse -> ../../peter/paul/mary 

/map/peter/paul/mary 

構造2は、物理的なフォルダが含まれていますが、最後のディレクトリが、これはシンボリックリンクである構造1の「メリー」へ

私は/map/horse/dog/mouseに変更し、私はpwdを作る場合、私は/map/horse/dog/mouseにしている場合だ場合、それは私に

/map/horse/dog/mouse 

を伝えた場合私はcd ..、私は

/map/horse/dog 

にしていますが、私は/map/horse/dog/mouseにいると私はls ..をすれば、それはmaryはなく、mouse言われます場合します。

私はls ..はシンボリックリンクを解決してくれmaryを示しているが、私はls ..が私にmouseを表示したいながらcdは、前回の作業ディレクトリdogとバックdogからcd ..変更を覚えていることを理解しています。

同じように私はls ../..に私にdogを表示します。

私が見つけたすべてのユースケースは、シンボリックリンクの解決と物理パスの表示です。しかし、私の場合は、 "ls"のために、私は解決されていない道だけを受ける方法が必要です。

"/馬/犬/マウス"にあり、 "ls .."を作っているので、 "マウス"を見たいですが、 "マリー"は見ません。

「マウス」の前に「mary」が存在するため、物理フォルダと「mary」のシンボリックリンクを「マウス」にすることは選択できません。

私の問題を解決するための助けとアイデアがありがとうございます。

+0

この質問は[unix.se]にもっと適しているようです。 –

答えて

0

ええ、デフォルトの動作は矛盾しています。 symlinks設定でその一部を制御できます。例えば:

set symlinks=chase 

あなたは(私が思う)欲しいものである、cdを使用した後、「本当の」ディレクトリに移動しますtcshようになります。

expandignoreの設定もあります。引用するtcsh(1)

symlinks (+) 
      Can be set to several different values to control symbolic link 
      (`symlink') resolution: 

      If set to `chase', whenever the current directory changes to a 
      directory containing a symbolic link, it is expanded to the 
      real name of the directory to which the link points. This does 
      not work for the user's home directory; this is a bug. 

      If set to `ignore', the shell tries to construct a current 
      directory relative to the current directory before the link was 
      crossed. This means that cding through a symbolic link and 
      then `cd ..'ing returns one to the original directory. This 
      affects only builtin commands and filename completion. 

      If set to `expand', the shell tries to fix symbolic links by 
      actually expanding arguments which look like path names. This 
      affects any command, not just builtins. Unfortunately, this 
      does not work for hard-to-recognize filenames, such as those 
      embedded in command options. Expansion may be prevented by 
      quoting. While this setting is usually the most convenient, it 
      is sometimes misleading and sometimes confusing when it fails 
      to recognize an argument which should be expanded. A compro‐ 
      mise is to use `ignore' and use the editor command normalize- 
      path (bound by default to ^X-n) when necessary. 
関連する問題