nev*_*ame 7 php bash command-line-interface
我从来没有在CLI中使用过PHP,但我看过使用PHP代码运行的脚本.
我在想:
在bash中执行许多常见任务仍然要容易得多.考虑为以下bash单行编写PHP等价物:
# remove a folder full of rubbish
rm -rf oldTrashFolder
# create an archive of files containing the word 'localhost'
tar cf backup.tar $(grep -rlw localhost ~/my-source-code)
# make a copy of a mysql database
{ echo "create database NEWDATABASE; "; mysqldump OLDDATABASE; } | mysql NEWDATABASE