crontab読み取りスクリプト

crontab読み取りスクリプト

両方を表示するスクリプトを取得しようとしていますが、そのうちのdate1netstat -a | grepつだけが表示されます。

#!/bin/bash

cd /var/www/armando.se
touch textfil1.txt
chmod 755 textfil1.txt
netstat -a | grep tcp &> date +"%Y-%m-%d" >textfil1.txt

ベストアンサー1

努力する

#!/bin/bash

cd /var/www/armando.se
netstat -a | grep tcp > textfil1.txt
date +"%Y-%m-%d" >> textfil1.txt
chmod 755 textfil1.txt

どこ

  • >>追加演算子です
  • touchパッケージングする前にファイルは必要ありません。

おすすめ記事