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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script problem replacing slash and backslash

Status
Not open for further replies.

YO123

MIS
Jul 26, 2001
77
BE
I'm writing a script with a dynamic creation of a file in a directory giving by the user.

The problem now is that the user can enter whatever directory he wnts, but one file needs to be created from a template in the beginning before the creation command can execute.

I got this far:
In the template there is a creation of a database. The database place is being created dynamically by using the sed command.

The user enter the destination directory: /home/user
but in the sed command this is not accepted. How can I convert this correctly so it works.

sed "s/TEMP/$dstdir/g" $srcdir/file.st > $dstdir/file.st

Thx

YO
 
Don't use "/" as the divider if it's going to be in the strings your supplying.

Try
[tt]sed "s,TEMP,$dstdir,g" $srcdir/file.st > $dstdir/file.st[/tt] One by one, the penguins steal my sanity. X-)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top