Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am running Ubuntu 12.04. In my accounts .bashrc file I have the line

alias ftreport='cd / && sudo tree > /home/<user name here>/Documents/Reports/Tree_$(date +%s).txt'

After typing the command ftreport, I get

bash: /home/<user name here>/Documents/Reports/Tree_<epoc time here>.txt: No such file or directory

The command ftreport must output my system's file tree in my ~/Documents/Reports folder with the file title consisting of "File", an underscore, the epoch time, and ".txt". What is wrong and what should it be?

share|improve this question

2 Answers 2

Make sure that you change <user name here> to your username. And make sure that you can write in the ~/Documents/Reports folder.

share|improve this answer
alias tpsreport='cd / && mkdir -p /home/$(whoami)/Documents/Reports && sudo tree > /home/$(whoami)/Documents/Reports/TPS_$(date +%s).txt && cd -'

Seems to work...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.