Error while trying to print message


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error while trying to print message
# 1  
Old 10-08-2008
Error while trying to print message

Hi all

Geting this error while trying to print message as :
./logfunc[4]: print: bad file unit number
heres what i m trying to do :

log_date="$(date '+%d/%m/%Y %H:%M:%S')"
log_type="Message"
print "${log_date}: ${log_type}"
print -u3 "${log_date}: ${log_type}"

this error is due to print -u3 option...
Can anyone explain the reason and wht does this option u3 does ?

Thanks in anticipation ,

Warm Regards,
Navatha

# 2  
Old 10-08-2008
With the -u3 option print sends its output to file descriptor 3.
To redirect the output to a file you can do something like:

Code:
3 > file
print -u3 "${log_date}: ${log_type}"

To print the output to the screen just remove the option.

Regards

# 3  
Old 10-08-2008
Hi Franklin,
Can you guide regarding file descriptors?

i know that there are 3 std unix file descriptors as stdi/p ,stdo/p and std err
Can you brief me abt file descriptors ?
# 4  
Old 10-08-2008
A guide regarding IO redirectors:

I/O Redirection

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to check the string in a file and print an attribute in the message

Hi, I am new to shell scripting and got a task to complete. Task is : we have a log file where in i need to traverse through the whole file to check the string "Person Type missing in message" and after that i need to get EMPLID=xxxxxx from the file and print details in a different file. ... (1 Reply)
Discussion started by: suren424
1 Replies

2. UNIX for Advanced & Expert Users

Print message while using sqlplus

I want to connect to oracle database from solaris... After that i will drop and create a no.of tables.One of the table example is as below. sqlplus -s usrname/password@dbname << SQL >> $logfile 2>&1 echo " dropping the table1" | tee logfile DROP TABLE Table1 echo "creating the table1" |... (1 Reply)
Discussion started by: millan
1 Replies

3. Shell Programming and Scripting

Print a message at specific line on prompt

Hi Friends, I am using HP-UNIX(ksh). I want to print a message at specific line on the prompt screen. For Example: for num in 1 10 3 145 do echo $num // need to print this on the same line for each number sleep 2 done Actual Output: ========== 1 10 3 145 Expected Output:... (5 Replies)
Discussion started by: Niroj
5 Replies

4. UNIX for Dummies Questions & Answers

Error message: What does it mean?

I get this error message in my maillog. Can someone tell me what it means? SYSERR(root): collect: I/O error on connection from mail-05.goomba.com I guess it means that the server could not connect to mail-06.goomba.com. Is my interpretation correct? Any idea why it happens? (1 Reply)
Discussion started by: mojoman
1 Replies

5. Solaris

To print Coloured Prelogin Message on SOLARIS--9................

Hiiii..... Every one...... I am using /etc/issue file to display Pre-login Message on my system, installed with SOLARIS-9. I am getting this Message in White fonts having Black background ( Colour of the Screen)..... So, is there ... (2 Replies)
Discussion started by: prashantshukla
2 Replies

6. Programming

How to implement SIGKILL and SIGTERM and print a message?

Hello, I am running a webserver that uses sockets, forks, and children. The parent process listens for connections and the child processes the information. I am trying to figure out why the code I have below SIGTERM, and SIGKILL never fire. I was messing around with the printfs and doesnt... (11 Replies)
Discussion started by: norelco55
11 Replies

7. UNIX for Advanced & Expert Users

Error message

Hi, My Solaris 5.8 system keeps getting this error at boot - "Can't set vol root to /vol" then /usr/sbin/vold: can't set vol root to /vol: Resource temporarily unavailiable Any idea what is wrong, and how do I fix it? (1 Reply)
Discussion started by: ghuber
1 Replies

8. AIX

Error Message with ls

When I try to list a directory that I have been using rsync to copy, I now am getting the following message. root # ls -alt /directory ls: /directory: Value too large to be stored in data type. total 0 I can change directory and list the contents of directories within /directory, but I... (2 Replies)
Discussion started by: sallender
2 Replies

9. UNIX for Advanced & Expert Users

Error message

I'm getting an error - symbol referencing errors. No output written to, etc Can anybody tell me why this is? (2 Replies)
Discussion started by: Dan Rooney
2 Replies
Login or Register to Ask a Question