Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
fold.txt1行を含むテキストファイルがありますfold_nam:
fold.txt
fold_nam
$ cat fold.txt fold_nam
テキストファイル内のこの名前は、フォルダの名前のプログラム実行中に作成された出力であり、このフォルダには、作業する必要のある他のファイルが含まれています。
大きなスクリプトを書いているので、このフォルダーに入る必要があり、テキストファイルから名前を取得する必要があります。私はいくつかのことを試しましたが、実際にはうまくいきません。
使用する必要はありませんcat:
cat
cd $(<fold.txt)
行を変数に読み込みたい場合:read -r folder_name < fold.txt
read -r folder_name < fold.txt
あなたはこれを行うことができるはずです:
cd $(cat fold.txt)
また
cd `cat fold.txt`