touch command

Is there a way to do...

touch ./config/newdir/newfile

if neither newdir and newfile exists?

man touch tells me there's not (?)
Is out there another tool to do that?
Thx in advance! :b:

Hi.

What about:

mkdir -p ./config/newdir && touch newfile

Or

(mkdir -p ./config/newdir && touch newfile) 2>/dev/null

Depends on what you are doing....Often times I will echo a command out to a text file and use > or >> which should create the full path to the file.

Even to a file in a not existing directory?

it a non existent directory, nope, sorry read that wrong

Hello,
Im using solaris10, it does not create full path tlarkin:

shell>echo "OOO" >> ./newdir/newfile.txt
bash: ./newdir/newfile.txt: No such file or directory

[/CODE]

However i know

mkdir -p 

and its combinations will help as Scottn mentioned earlier.

Yeah I read your question wrong, sorry my bad. I thought the directory already existed.