473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

File Not found Error

#!/bin/bash
cat /var/backup/192.168.4.3/dirnum.prn | awk '{print $1}'


if i put above script can read the file.

#!/bin/bash
file1=/var/backup/192.168.4.3/dirnum.prn
exec <$file1
while read line
do
echo "$line"
done



but the above script can not read the file and gives error msg "The file or directory not found"


I am confused why its happening.Please help me.
Jul 5 '07 #1
2 2408
sicarie
4,677 Expert Mod 4TB
#!/bin/bash
cat /var/backup/192.168.4.3/dirnum.prn | awk '{print $1}'


if i put above script can read the file.

#!/bin/bash
file1=/var/backup/192.168.4.3/dirnum.prn
exec <$file1
while read line
do
echo "$line"
done



but the above script can not read the file and gives error msg "The file or directory not found"


I am confused why its happening.Please help me.
Exec is supposed to read in a command and its arguments, you're just passing it a file. I would recommend (if you're set on using exec), to use cat as well.

If you're not set on using exec, I would recommend creating a variable (such as s_lines - prefixing it with the datatype (trust me, it makes the script easier to modify later if you need to)) and doing something like

s_lines=`cat $file1`
echo "$s_lines"

You can mess around with having the quotes or not. (Oh, and this is the Articles section. Not a big deal, but please be aware next time you post - to get in the Forum section!)
Jul 6 '07 #2
r035198x
13,262 8TB
Exec is supposed to read in a command and its arguments, you're just passing it a file. I would recommend (if you're set on using exec), to use cat as well.

If you're not set on using exec, I would recommend creating a variable (such as s_lines - prefixing it with the datatype (trust me, it makes the script easier to modify later if you need to)) and doing something like

s_lines=`cat $file1`
echo "$s_lines"

You can mess around with having the quotes or not. (Oh, and this is the Articles section. Not a big deal, but please be aware next time you post - to get in the Forum section!)
Moved to forum section
Jul 6 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: o'seally | last post by:
solaris/linux admins/rookie_developers that battle with this error are probably all frustrated when it happens. i bet you're also somehow frustrated by this seemingly unsolvable error :-) ...take...
1
by: Michelle Hillard | last post by:
Hi guys, would appreciate if you can shed some light on this. Sorry to be a pain, can you tell me what is wrong with the following: for /F %%i in ('dir /b /on c:\bcp\pc*.txt') do bcp...
11
by: mkarja | last post by:
Hi, I'm trying to figure out how to read some range of rows from a file. Is it possible to search the file with some criteria and then when the search string is found read 3 rows before and...
3
by: Michael Bøcker-Larsen | last post by:
Hi I'v been stuck on this problem for ages now. I have found that I'm not the only one with this problem, by looking through the different newsgroups. Hope you can help me! I know there is a...
7
by: Mark | last post by:
Hello, I have researched and tried every thing I have found on the web, in groups and MS KB articles. Here is what I have. I have a Windows 2000 Domain Controller all service packs and...
1
by: Olav Tollefsen | last post by:
I get the included error message when trying to run my ASP.NET application under Windows Server 2003 (with all updates installed). How can I troubleshoot this? Olav File or assembly name...
2
by: John Regan | last post by:
Hello All I am trying to find the owner of a file or folder on our network (Windows 2000 Server) using VB.Net and/or API. so I can search for Folders that don't follow our company's specified...
2
by: Roger Twomey | last post by:
I am working on a filewatcher application. The premis is: User uploads an xml file onto the web server the filewatcher app sees the xml file filewatcher app reads the file and inserts...
1
by: Christian Rühl | last post by:
hey! what i wanna do sounds very simple at first, but it turned out to be a real bone crusher... i want to check if a treeView node is checked and if a correspondent node in my xml config file...
3
by: meettapan | last post by:
I want to create the log file as below:- 2007/03/09 19:12:08 : ~extasc_cdr_20061230.csv.vcdr 2007/03/09 19:23:02 : ~extasc_cdr_20061230.csv.vcdr 2007/03/09 19:42:13 :...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.