Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create file in script 1

Status
Not open for further replies.

sandeepmur

Programmer
Dec 14, 2003
295
PT
Hi,

I am editing a huge script where I basically want to create a file within a function something like:

newFile () {
echo AAAAAAAAAAAAAAAA
echo BBBBBBBBB > bbb.txt
}

newFile

The problem is that the above works fine as a standalone in a script but when I place this in the script I am editing, no file is being created.. Why is that ?? is there something in the script that deletes/ prevents this ??

thnx in adv,
 
What is the part of the script you are editing that includes the newFile function?
 
at the very bottom of the script (usually) you will see all the names of the functions created, you need to add newFile to be ran.
 
whats strange is that is if I do an echo inside the function or even something like CAT bbb.txt after creating the file, it outputs fine ! but when I do an ls, the file bbb.txt simply doesnt appear !..

I tried placing newFile all over the script.. begining and end to no avail..

any suggestions ?

thnx
 
Hi,

Mybe your script is doing some cd commands before it executes your function.

Try with absolute name like this :

echo "somthing" >> /tmp/yourefile.txt
and look for it in /tmp directory.

Ali
 
yes yes... At the very begining I have a CD command ! argh.. thnx a lot !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top