linux - Redirect w output to a file -
how redirect w
output file in $date
named $time.users
?
i have not sure works:
w > $time.users
i have created directory in .bash_login
, called ~/sysadmin1/my_peeps/$date
.
also, inside .bash_login
created 2 variables
date=$(date +"%m/%d/%y") time=$(date +"%h:%m:%s")
if $time
not set, line becomes
w > .users
so output redirected hidden .users
file. can see using ls -a
.
also note need export variables in bash
make them available in child shells:
export time=$(date +"%h:%m:%s")
Comments
Post a Comment