- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Need help
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
Discussions
Discussions
Forums
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
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
тАО08-20-2008 10:54 PM
тАО08-20-2008 10:54 PM
Need help
I have written a shell script and getting error.Any help on how to fix it.
update a439487.ora_dev_inventory set HA='${sa_svr}' where lower(HOST_NM)='${pa_svr}' and INV_DT=sysdate;..i getting error in this line.
I have set the environment variable (sa_svr,pa_svr).
error message.
Bad : mod in $.
Any help/
- Tags:
- csh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-20-2008 11:15 PM
тАО08-20-2008 11:15 PM
Re: Need help
You example seems to mix comments and shell commands, please put them one per line so we can see them. Or you may have to attach your script.
- Tags:
- scummy C shell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-20-2008 11:18 PM
тАО08-20-2008 11:18 PM
Re: Need help
#!/bin/csh
sqlplus
set heading off;
set serveroutput on;
DECLARE
instance_nme varchar2(30);
rac_status varchar2(10);
host_nme varchar2(20);
begin
select instance_name,host_name,parallel into instance_nme,host_nme,rac_status from v\$instance;
dbms_output.put_line(instance_nme||':'||host_nme||':'||rac_status);
end;
/
EOF
##Ogrep -vw "YES" vinoth.log > vinoth1.log
grep "YES" vinoth.log > vinoth1.log
cat vinoth1.log|awk -F: '{print $2}' > vinoth_nrac.log
foreach host ( `cat /datdevdal2/fdat/dev/vinoth/vinoth_nrac.log` )
#do
rsh $host -l datprd ps -ef|grep had|grep -v grep > /tmp/vinoth.txt
if ( ! -z /tmp/vinoth.txt) then
rsh $host -l datprd cat /etc/llthosts|grep -w 1|awk '{print $1":"$2}'> ha2.txt
##rsh $host -l datprd cat /etc/llthosts > temp.txt
set sa_svr=`cat ha2.txt|awk -F: '{print $2}'`
##set pa_svr=`cat ha2.txt|awk -F: '{print $1}'`
rsh $host -l datprd cat /etc/llthosts|grep -w 0|awk '{print $1":"$2}'> ha3.txt
set pa_svr=`cat ha3.txt|awk -F: '{print $2}'`
echo $sa_svr
echo $pa_svr
-----Till this no error looks fine.
#db_nm=`grep $1 vinoth.log|awk '{print $1}'`
sqlplus
update a439487.ora_dev_inventory set HA='${sa_svr}' where lower(HOST_NM)='${pa_svr}' and INV_DT=sysdate;
#rsh $1 -l datprd cat /etc/llthosts|grep -w 1|awk '{print $2}' > ha2.txt
#echo "$1:`cat ha2.txt`"
commit;
/
endif
EOF
#done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2008 12:20 AM
тАО08-21-2008 12:20 AM
Re: Need help
Reading the scummy csh man page carefully shows this is the bad line:
#echo "$1:`cat ha2.txt`"
You need to change it to:
#echo "${1}:`cat ha2.txt`"
If you used a real shell you could just do:
echo "$1:$(< ha2.txt)"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2008 02:51 AM
тАО08-21-2008 02:51 AM
Re: Need help
I'm with Dennis. Avoid the C shell! You should read this classic post by Tom Christiansen:
http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
I would urge you to use the standard HP-UX shell ('/usr/bin/sh') which is a POSIX superset of the Korn shell. For 'root' this shell exists as '/sbin/sh' and is a statically linked binary necessary during boot up when '/usr' isn't mounted and hence the dynamic libaries are not available.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2008 02:05 AM
тАО08-22-2008 02:05 AM
Re: Need help
http://forums.itrc.hp.com/service/forums/helptips.do?#33