0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

cshファイル

make_log.csh
#!/bin/csh

# cshファイル名を取得
set cshFileName = `basename $0`

# cshファイル名のベース名をジョブ名として取得
set jobName = `basename $0 .csh`

# ベース名がcshファイルと同logファイル名を定義
set logFileName = ${jobName}".log"

# logファイルを作成
touch ${logFileName}

# cshファイル名とジョブ名をlogファイルに書き込み
echo "cshファイル:"${cshFileName} >> ${logFileName}
echo "ジョブ名:"${jobName} >> ${logFileName}

実行結果

make_log.log
cshファイル:make_log.csh
ジョブ名:make_log

詰まった点

  • コマンドの実行結果を変数に格納する処理
    • コマンド部分はシングルクォーテーション「''」ではなくグレイヴアクセント「``」で囲む
set cshFileName = `basename $0`
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?