Print command issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Print command issue
# 1  
Old 05-14-2013
Print command issue

Hi,

OS - Linux

Print command is working in some scripts and not working in some other scripts.

We migrated the scripts from HP UX to Linux.

Default shell - korn

By using printf it working. But why these difference?

Thanks
# 2  
Old 05-14-2013
let us know where it is not working and post some examples please?
# 3  
Old 05-14-2013
Hi,

thanks for reply

Code:
#
#!/usr/bin/ksh
#
#  Set up parameters
lc=1
st_date=$(date +%m%d%H%M)
date=$(date)
LOGFILE=$HOME/log/odw01_load.log.$st_date
print "Check for workflow.dat file" >> $LOGFILE

In script it not printing, but individually working

User01@awg43lix02v>> print "Check for workflow.dat file"
Check for workflow.dat file


Error log -
/home/odw/1.0.0/bin/odw01_load.run: line 9: print: command not found
/home/odw/1.0.0/bin/odw01_load.run: line 36: print: command not found
# 4  
Old 05-14-2013
Could you please check where exactly print command reside on your server
Code:
which print

also do
Code:
echo $SHELL

to identify default shell used
# 5  
Old 05-14-2013
Code:
bash-3.2$ which print
which: no print in 

bash-3.2$ which printf
/usr/bin/printf
bash-3.2$
bash-3.2$ echo $SHELL
/usr/bin/ksh


Last edited by Franklin52; 05-15-2013 at 03:26 AM.. Reason: Please use code tags
# 6  
Old 05-14-2013
Please note that print is a ksh built-in and should be available.

You should put your shebang at the first line of your script:
Code:
#
#!/usr/bin/ksh
#

Due to this reason script is not using ksh, hence print is not available.
# 7  
Old 05-14-2013
Define a print function:
Code:
print() { echo "$@"; }

or alias
Code:
alias print=echo

Or install pdksh; it gives you a compatible /bin/ksh
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issue using awk to print min values for unique ids

I am using the following script to search for and print minimum values for each individual Fields (3-14) for each unique id (Field 1). But when the field contains a "-99.99" ( I am ignoring "-99.99") and when the minimum value is the first line of a new id (Field 1), the output does not print Field... (13 Replies)
Discussion started by: ncwxpanther
13 Replies

2. Shell Programming and Scripting

Variable value substitution issue with awk command issue

Hi All, I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command. The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies

3. Shell Programming and Scripting

Not able Print next command

Hi All, I'm wrting one script which checks health of the server.But couldn't understand why script is not printing any value for this also its not allowing to print other command just after this. ps -aef |egrep -i "fcm|comm" (1 Reply)
Discussion started by: netdbaind
1 Replies

4. Red Hat

CUPS print issue

Hi all, unable to print from linux box. Earlier it used to work fine. The print job is sitting in the queue and not going to printer. Removed queue job and tried again but no luck. Tried "cupsenable" but ended up with no success. I tried to print two text files as "root" with "lp " command... (0 Replies)
Discussion started by: lramsb4u
0 Replies

5. Programming

Display issue when we print in for loop

Hi All, I have connected to the board using telnet, when i tried to display huge record which has more then 1000, this telnet session where overlapping the printed data to the previous line. Can some one help me how to solve this? For example" in a for loop i am printing "1 Name1"... (3 Replies)
Discussion started by: mohi
3 Replies

6. UNIX for Dummies Questions & Answers

grep pipe filename print issue

uname -a SunOS mypc 5.10 Generic_141414-07 sun4v sparc SUNW,SPARC-Enterprise-T2000 uname -a SunOS mypc 5.10 Generic_144488-07 sun4v sparc SUNW,SPARC-Enterprise-T5220 find . -name "*.cer" -exec keytool -v -list -printcert -file {} \; | grep -i "Aug 03" Valid from: Mon Jan 29 00:00:00 GMT... (16 Replies)
Discussion started by: shifahim
16 Replies

7. Shell Programming and Scripting

print command in awk

Hi can print command in awk take the variable and write its value in the file? Excerpt from my shell script. for some reason, $proc is being written in the file instead of its value. can someone tell me what is the issue? for proc in EH LOGEV do echo $proc ./plist -P $proc |... (2 Replies)
Discussion started by: lookinginfo
2 Replies

8. Shell Programming and Scripting

print command

Is there a way in the Korn Shell to print like below: print "the red fox jumped \ <6 spaces> over the brown house.\n" > test.out And have the output look like the folowing: the red fox jumped over the brown house. Our shell scripting standards state that no line can be over 78... (2 Replies)
Discussion started by: djehresmann
2 Replies

9. Shell Programming and Scripting

Perl script issue: print

Can someone tell me what I'm doing wrong with my perl script? I am new to Perl. This isn't even the final script, I'm just testing to see if it will print the directories with the files in it. For some reason my output is only printing the 1st, 6th, and last entries of the @sub_dir array. Each... (3 Replies)
Discussion started by: man
3 Replies

10. UNIX for Dummies Questions & Answers

What command do you use to clear the print que?

Hi, I have a user that has tried to print a job several times and has now filled up the que. How do i delete all the jobs in the que and what is the command?:confused: (1 Reply)
Discussion started by: nov_user
1 Replies
Login or Register to Ask a Question