- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: script problem in reading parm file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 08:33 PM
01-24-2005 08:33 PM
#!/bin/sh
. test.ini
cp $param_file2 $param_file_bak2
cat $param_file2 > a.log
echo "----below is the reading value ------" >> a.log
for i in `cat $param_file2`
do
echo $i
echo $i >> a.log
done > tparam_file
Output:
[PD_ODS.s_m_FHOPEHS_TO_ODS_OTHERS_ALL_22]
[PD_ODS.s_m_FHOPEHS_TO_ODS_OTHERS_ALL_2]
[PD_ODS.s_m_FHOPEHS_TO_ODS_OTHERS_ALL_11]
[PD_ODS.s_m_FHOPEHS_TO_ODS_OTHERS_ALL_AA]
[PD_ODS.s_m_FHOPEHS_TO_ODS_OTHERS_ALL_A]
[PD_ODS.s_m_FHOPEHS_TO_ODS_OTHERS_ALL_A1]
----below is the reading value ------
[PD_ODS.s_m_FHOPEHS_TO_ODS_OTHERS_ALL_22]
[PD_ODS.s_m_FHOPEHS_TO_ODS_OTHERS_ALL_2]
1
[PD_ODS.s_m_FHOPEHS_TO_ODS_OTHERS_ALL_AA]
[PD_ODS.s_m_FHOPEHS_TO_ODS_OTHERS_ALL_A]
1
We found out that there is a file name "1" in the same directory as the script.
Any idea how to over come this?
thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 08:47 PM
01-24-2005 08:47 PM
Re: script problem in reading parm file
can first check that the filenames are ok with:
ls -b PD_ODS.s_m_FHOPEHS_TO_ODS_OTHERS_ALL_*
This should eliminate any filename corruption.
Secondly why do you have a "> tparam_file"
at the end of your loop?
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 08:47 PM
01-24-2005 08:47 PM
Re: script problem in reading parm file
try to use while loop instead of for
syntax:
cat $param_file2 | while read
do
i=$REPLY
echo $i
echo $i >> a.log
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 08:58 PM
01-24-2005 08:58 PM
Re: script problem in reading parm file
PD_ODS.s_m_FHOPEHS_TO_ODS_OTHERS_ALL_22]
[PD_ODS.s_m_FHOPEHS_TO_ODS_OTHERS_ALL_2]
1
A
A
1
somehow there cannot have a file with a letter or number same as the end of output in the same directory as the script.
This script is a portion of the application script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 09:00 PM
01-24-2005 09:00 PM
Re: script problem in reading parm file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 09:11 PM
01-24-2005 09:11 PM
Re: script problem in reading parm file
param_file2="p.txt"
param_file_bak2="p.bak"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 09:21 PM
01-24-2005 09:21 PM
Re: script problem in reading parm file
I would assume that the problem is that the shell performs file name substitution in the current directory. The cure is to qoute the regular expressions in the script.
You say that it is a portion of the script; typical places to look for culprits are square brackets, e.g. [a-z] and asterisks.
Try double qouting.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 09:29 PM
01-24-2005 09:29 PM
Solution#!/bin/sh
. test.ini
cp $param_file2 $param_file_bak2
cat $param_file2 > a.log
echo "----below is the reading value ------" >> a.log
set -f
for i in `cat $param_file2`
do
echo $i
echo $i >> a.log
done > tparam_file
set +f
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2005 09:35 PM
01-24-2005 09:35 PM