cp: `/vol/examples/tutorial/science.txt' を stat できません: そのようなファイルまたはディレクトリはありません

cp: `/vol/examples/tutorial/science.txt' を stat できません: そのようなファイルまたはディレクトリはありません

コマンドを試してみたcp /vol/examples/tutorial/science.txt .ところ、エラーが発生しました -

cp: cannot stat `/vol/examples/tutorial/science.txt': No such file or directory

なぜこのようなことが起こるのか分かりません。cygwin ホーム フォルダーに移動して、必要なフォルダー構造とテキスト ファイルを作成しました。また、フォルダー構造と名前も確認しました。

また、 を入力し~/vol/examples/tutorialて実行するとcat science.txt、ドキュメントを読むことができます。では、なぜ CP コマンドが機能しないのでしょうか?

答え1

これをやれば次のことが分かります:

cd ~/vol/examples/tutorial 
pwd

おそらく、PWDの結果はただで/vol/examples/tutorialはなく/home/username/vol/examples/tutorial

~ は、通常は cygiwn /home の下にあるユーザーのホーム ディレクトリに置き換えられます。

関連情報