I’m trying to create an alias to open up my log fie
alias open_log='date=`date +%y%m%d`;sudo tail -n 10 ~/logs/reconfig-$date.log;'
When I run that alias
open_log
I got
tail: cannot open ‘/home/benu/logs/reconfig-.log’ for reading: No such file or directory
But if I run
"what I set for that alias"
date=`date +%y%m%d`;sudo tail -n 10 ~/logs/reconfig-$date.log;
It works perfectly fine.
+ service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables: [ OK ]
+ mkdir -p /etc/nginx/sites-available
+ cp /root/portal-data/sites-available/default-https /etc/nginx/sites-available/default
+ '[' '!' -f /etc/ssl/mywifibusiness.trg.telenet.be.cert.pem ']'
+ echo 'Error: Unable to find certificate at /etc/ssl/mywifibusiness.trg.telenet.be.cert.pem'
Error: Unable to find certificate at /etc/ssl/mywifibusiness.trg.telenet.be.cert.pem
+ exit 1
Error: Executing /home/benu/reconfig.d/70-ssc-portal.sh returned 1
Reconfigure aborted
Why they’re behaving different ? Can anyone elaborate ?
How do I fix my alias to make it work ?
alias open_log="sudo tail -n 10 ~/logs/reconfig-$(date +%y%m%d).log"
date=
date +%y%m%d; echo -e "~/logs/reconfig-$date.log" | sudo tail -n 10;
, but it does is printing out my path command, rather than running that command. How do I fix it guys ?date
or something like that?alias open_log="tail -n 10 ~/logs/reconfig-$(date +%y%m%d).log;"
?