Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
up vote 5 down vote accepted

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

Your Answer


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.