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 have the function:

function >> file.txt

this creates the file.txt in my current directory. I have a folder log in the same directory, how would I request file.txt to be created in my log file (a directory higher)? I tried:

function >> log/file.txt

and am unsure why this didn't work for me

share|improve this question
1  
That should've worked. Did you get any error messages? Perhaps add set -x to the start of the script to debug it. –  geirha Jul 23 '12 at 15:42
    
WHAT didn't work? Was anything appended to your file? Did the file not exist afterwards? Did the directory not exist before? Please post the error messages, if any or tell us what "didn't work" for you. –  ohno Jul 23 '12 at 16:00
add comment

1 Answer

supposing that you have this structure

  • dummy directory
    • log directory
    • working directory

if you are in the working directory you should run

function >> ../log/file.txt 

a quick explanation is:

  • the single dot . means this level
  • the double dots .. means go up 1 level
share|improve this answer
add comment

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.