473,545 Members | 2,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File Not found Error

1 New Member
#!/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.Pleas e help me.
Jul 5 '07 #1
2 2421
sicarie
4,677 Recognized Expert Moderator Specialist
#!/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.Pleas e 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 MVP
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
16611
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 it easy, it'll go away once u've learned how to play around with a few things on your system and reorganised. i'm particulary a solaris junkie, but...
1
14352
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 Inventory..pc in %%i -fc:\bcp\bcp.fmt -T -S CHICKYy where CHICKYy is the server bcp.fmt
11
2580
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 after that row from where the search string was found ? Of course the row where the string was found should also be read. I have a log file in txt...
3
12163
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 lot of information, but if you need more (e.g. the code) please write michael@mblarsen.dk. The problem is this error messages (the code is build...
7
13367
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 every thing else from windows update. ..NET 1.0 and 1.1 installed on the server. Actually .NET was installed before the server was made a DC.
1
5042
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 System.Xml, or one of its dependencies, was not found. Description: An unhandled exception occurred during the execution of the current web request....
2
5030
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 folder structure and naming conventions and then send a Net send message to those users telling them to rectify. The information I want to get is when...
2
5204
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 records into our sql server filewatcher app deletes the file. I am trying to figure out the best method of doing this, so I am adding code bit by bit....
1
3261
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 exists just to sort of synchronize them by changing the xml nodes attribute(s). somehow i always catch an exception "blabla has an invalid token"...
3
14076
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 : ~extasc_cdr_20061230.csv.vcdr File ID : 10241 Input records : 72 Rated records : 3 Database records : 3 Zero...
0
7408
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7661
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7815
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5976
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5340
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4949
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3458
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
712
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.