Print : Bad Options


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Print : Bad Options
# 1  
Old 08-13-2012
Print : Bad Options

Hi,

I have this script here and it works fine but we keep getting this error and wanted to know how to stop it. Everything still works fine even though I'm seeing this error:

Code:
typeset    hd=""
typeset -i hdsize=0
typeset -i hdsum=0

exec 3><directory>/hdisk-2145

print -u "---- 2145 disks / sizes at $(date)"
cat hdisk | while read hd ; do
     if [ $(lscfg -vl $hd | grep -c 2145) -ge 1 ] ; then
          hdsize=$(getconf DISK_SIZE /dev/${hd})
          (( hdsum += hdsize ))
          print -u3 "$hd has size $hdsize"
     fi
done
print -u3 "Sum over all 2145 disks: $hdsum"
exec 3>&-


This is the error:

Code:
<Directory> ./hdisk-2145.ksh
./hdisk-2145.ksh[7]: print: bad option(s)

Whats missing?
# 2  
Old 08-13-2012
Hi,

Can you post the contents of "hdisk-2145.ksh".

Regards

Dave
# 3  
Old 08-13-2012
Code:
print -u -- "---- 2145 disks / sizes at $(date)"

This User Gave Thanks to elixir_sinari For This Post:
# 4  
Old 08-13-2012
Quote:
Originally Posted by elixir_sinari
Code:
print -u -- "---- 2145 disks / sizes at $(date)"

This worked Thank you!

---------- Post updated at 10:23 AM ---------- Previous update was at 10:20 AM ----------

Quote:
Originally Posted by elixir_sinari
Code:
print -u -- "---- 2145 disks / sizes at $(date)"

One more question:

instead of having "has size" can i replace that with a tab option.

reason is I put these into excel and saves me time if there's a tab instead of manually doing it myself.
Code:
cat hdisk | while read hd ; do
     if [ $(lscfg -vl $hd | grep -c 2145) -ge 1 ] ; then
          hdsize=$(getconf DISK_SIZE /dev/${hd})
          (( hdsum += hdsize ))
          print -u3 "$hd has size $hdsize"

# 5  
Old 08-13-2012
Just replace " has size " with "\t".
This User Gave Thanks to elixir_sinari For This Post:
# 6  
Old 08-13-2012
Quote:
Originally Posted by elixir_sinari
Just replace " has size " with "\t".
Great works! Thank you!
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Programming

[Perl] Different printf formating for different print options

Hi, Struggling with single quotes, double quotes, etc. I want to print a header line, followed by lines with actual values, based on a print option. In real life it is going to be something like 15 print options and 50 values. Output will be 1 header and several value lines. In this example... (5 Replies)
Discussion started by: ejdv
5 Replies

2. Solaris

bad options(s)

Hi Folks, I am seeing an issue in solaris, while running a script.. Script contents #!/usr/bin/bash echo $HOME echo "********** RUNNING props on test ********" . /opt/home/weblogic/.profile > /dev/null echo "****** CURRENT BRANCH: $BRANCH *********"; .... (3 Replies)
Discussion started by: ganga.dharan
3 Replies

3. Ubuntu

Kernel boot options removed by fault, no boot options

Hello Everyone, First of all, I highly appreciate all Linux forum members and whole Linux community. http://forums.linuxmint.com/images/smilies/icon_wink.gif. I wish you the best for all of you ! I will try to be short and concise: I am using Linux Mint 10 for 2 months on 2 ws, and all went... (3 Replies)
Discussion started by: cdt
3 Replies

4. Shell Programming and Scripting

Why I get bad bad substitution when using eval?

Why I get bad replace when using eval? $ map0=( "0" "0000" "0") $ i=0 $ eval echo \${map$i} 0000 $ a=`eval echo \${map$i}` !!!error happens!!! bash: ${map$i}: bad substitution How to resolve it ? Thanks! (5 Replies)
Discussion started by: 915086731
5 Replies

5. Shell Programming and Scripting

print first few lines, then apply regex on a specific column to print results.

abc.dat tty cpu tin tout us sy wt id 0 0 7 3 19 71 extended device statistics r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device 0.0 133.2 0.0 682.9 0.0 1.0 0.0 7.2 0 79 c1t0d0 0.2 180.4 0.1 5471.2 3.0 2.8 16.4 15.6 15 52 aaaaaa1-xx I want to skip first 5 line... (4 Replies)
Discussion started by: kchinnam
4 Replies

6. Shell Programming and Scripting

Script to search a bad record in a file then put the record in the bad file

I need to write a script that can find a bad record (for example: there is date field colom but value provided in the file for this field is N/A) then script shoud searches this pattern and then insert the whole record into the bad file. Example: File1 Name designation dateOfJoining... (2 Replies)
Discussion started by: shilendrajadon
2 Replies

7. UNIX for Advanced & Expert Users

Script to search a bad record in a file then put the record in the bad file

I need to write a script that can find a bad record (for example: there is date field colom but value provided in the file for this field is N/A) then script shoud searches this pattern and then insert the whole record into the bad file. Example: File1 Name designation dateOfJoining... (1 Reply)
Discussion started by: shilendrajadon
1 Replies

8. UNIX for Dummies Questions & Answers

I just did something bad....

I ran rm -rf lib*, I intended libm*, it deleted the whole lib dir from root. This is a dedicated webserver. What should I do? (4 Replies)
Discussion started by: Lss1
4 Replies
Login or Register to Ask a Question