473,399 Members | 3,832 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,399 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 2410
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.