
質問:
私はbash
本(Linux Shell Scripting with Bash、Ken O. Burch)で学んでいますが、今フォローしている本では次のコマンドを使用しています。
/usr/bin/statftime
ただし、Linuxではこのコマンドが見つかりません。
私はDebian 9.0拡張版を使用しています。
質問:
このコマンドについて教えてもらえますか? Debian にインストールできますか? Debianにどのようにインストールしますか?
編集する:
この本は私が読んだ本の中で最高の一つですbash
。 (Bashを使用したLinux Shell Scripting、Ken O. Burch)(@ Gilles)したがって、これはトリックではないかもしれません。以下のコードを投稿します。
コードは次のとおりです。
#!/bin/bash -x
#
# polling.sh: a daemon using polling to check for new files
shopt -s -o nounset
declare -rx SCRIPT=${0##*/}
declare -rx INCOMING_FTP_DIR="/home/ftp/ftp_incoming"
declare -rx PROCESSING_DIR="/home/ftp/processing"
declare -rx statftime="/usr/local/bin/statftime"
declare FILE=""
declare FILES=""
declare NEW_FILE=""
printf "$SCRIPT started at %s\n" "`date`"
# Sanity checks
if [[ ! -d /home/ftp/ftp_incoming ]] || [[ ! -d /home/ftp/processing ]]
then
mkdir -p /home/ftp/ftp_incoming
mkdir -p /home/ftp/processing
if [ "$?" -ne 0 ]
then
echo "You are a idiot"
else
echo "You succeded!"
fi
fi
if test ! -r "$INCOMING_FTP_DIR"
then
printf "%s\n" "$SCRIPT:$LINENO: unable to read the incoming directory --aborted" >&1
exit 1
fi
if test ! -r "$PROCESSING_DIR"
then
printf "%s\n" "$SCRIPT:$LINENO: unable to read the incoming directory --aborted" >&1
exit 1
fi
if test ! -r "$statftime"
then
printf "%s\n" "$SCRIPT:$LINENO: unable to find or execute $statftime --aborted" >&1
exit 1
fi
# Poll for new FTP files
cd $INCOMING_FTP_DIR
while true
do
#check for new files more than 30 minutes unchanged
FILES=`find . -type f -mmin +30 -print`
# If new files exist, move them to the processing directory
if [ ! -z "$FILES" ]
then
printf "$SCRIPT: new files have arrived at %s\n" "`date`"
printf "%s\n" "$FILES" |
{
while read FILE
do
# Remove leading "./"
FILE=${FILE##*/}
# Rename the file with the current time
NEW_FILE=`$statftime -f "%_L%_a_%T.dat" "$FILE"`
if [ -z "$NEW_FILE" ]
then
printf "%s\n" "$SCRIPT:$LINENO: statftime failed to create a new filename--skipping"
else
# Move the file to the processing directory
printf "%s\n" "$SCRIPT: moved $FILE to $PROCESSING_DIR/$NEW_FILE"
mv "$FILE" "$PROCESSING_DIR/$NEW_FILE"
fi
done
}
fi
sleep 30
done
printf "$SCRIPT finished unexpectedly at %s\n" "`date`"
exit 1
以下は、コマンドに関するいくつかの情報です。
答え1
解決策
簡単な検索は合格Google 統計時間探しているプログラムのソフトウェアベンダーを最初の結果として返します。 ペガソフトLinuxに焦点を当てたブログのように見えます。Adaプログラミング言語。
検索はstatftime debian
Debianリポジトリに関連するものを返さないことに注意してください。これインストールに関する注意必要になります構築に必要なパッケージ、設置手順は次の場所にあります。Debian Linux は GNU GCC コンパイラと開発環境をインストールします。。あなたの本のどこかにリンクが脚注のような形で存在すると確信しています。