The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
very bizzare file writing problem JamesGoh High Level Programming 10 11-27-2008 07:37 PM
serach and replace file name in the path in a remote xml file kiranreddy1215 Shell Programming and Scripting 1 11-12-2007 11:31 AM
Reading a file and writing the file name to a param file. thebeginer UNIX for Advanced & Expert Users 1 10-05-2007 05:38 PM
vi - replacing a relative path with absolute path in a file Yinzer955i UNIX for Dummies Questions & Answers 2 09-07-2006 12:47 PM
Problem with File path sandeep_hi Shell Programming and Scripting 3 06-19-2006 09:21 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-15-2009
Vintage_hegoog Vintage_hegoog is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 1
Question Problem writing file path to txt file

if test -z "$1"
then echo "you must give a filename or filepath"
else path=`dirname $1`
f_name =`basename $1`
if path="."
then path=`pwd`
fi
fi
cat $f_name $path >> index.txt

The only problem I am encountering with this is writing $path to index.txt
Keeps going gaga:

cat: /home/07004111/scripts: Is a directory

Is there a way round this?
  #2 (permalink)  
Old 01-15-2009
hemangjani hemangjani is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 73
I'm not sure if I understood the question correctly. But,

Why dont you use 'echo' instead of 'cat'

echo $f_name $path >> index.txt
Closed Thread

Bookmarks

Tags
write filepath to file

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:40 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0