シェルスクリプト総合 その25©5ch.net
■ このスレッドは過去ログ倉庫に格納されています
0653名無しさん@お腹いっぱい。
2016/06/13(月) 22:21:10.97それ、自分が前悩んで作ったのがある。誰か改善してくれ
#!/bin/sh
file=$1
test -f $file || exit 0
# if size -eq 0; then exit 0
if [ ! -s $file ]; then
exit 0
fi
# if the last character is not \n, then echo
if [ "$(tail -c 1 $file | cat -A)" != "$" ]; then
echo
fi
if ! tail -n 1 $file | grep '^$' > /dev/null ; then
echo
fi
■ このスレッドは過去ログ倉庫に格納されています