Visit Our UNIX and Linux User Community


An urgent assistance


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting An urgent assistance
# 1  
Old 10-30-2009
An urgent assistance

Hi.
Does any one know when the below will print hi ?
Code:
[ -t 0 ] || echo hi

Thanks in advance

Last edited by pludi; 10-30-2009 at 07:16 AM.. Reason: code tags, please...
# 2  
Old 10-30-2009
It belongs to which shell and which script..
# 3  
Old 10-30-2009
Very simple way to test: enter it in your terminal emulation / console.
# 4  
Old 10-30-2009
Code:
man test :

  -t [fildes]    True if the open file whose file descriptor number
                          is fildes (1 by default) is associated with a
                          terminal device.

# 5  
Old 10-30-2009
Quote:
Originally Posted by kinny
Hi.
Does any one know when the below will print hi ?
Code:
[ -t 0 ] || echo hi

Thanks in advance
If standard output is NOT connected to a terminal echo hi.
# 6  
Old 10-30-2009
It will print "hi" when there is no terminal (e.g. from "cron" or "at").

Quick test if you have permissions to use "at":

Code:
at now
[ -t 0 ] || echo hi
ctrl/D

Result is in unix mail for the user submitting the "at" job.

Previous Thread | Next Thread
Test Your Knowledge in Computers #673
Difficulty: Medium
Norman Abramson, a professor at the University of Hawaii, developed the first wireless computer communication network, ALOHAnet.
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script assistance Urgent

write a script using shift and case to receive 11 argument and do the following --arg1 - print hello message and the current proccess id --arg2 - read and edit a file based on the value which came along with the arg2. --arg3 - validate whether all... (1 Reply)
Discussion started by: saku
1 Replies

2. Shell Programming and Scripting

URGENT Reading a file and assessing the syntax shell script URGENT

I am trying to write a shell script which takes an input file as an arguement in the terminal e.g. bash shellscriptname.sh input.txt. I would like for the file to be read line by line each time checking if the .txt file contains certain words or letters(validating the syntax). If the line being... (1 Reply)
Discussion started by: Gurdza32
1 Replies

3. AIX

AIX 3.2.5 Assistance

I am looking for any help on locating a set of install disks or downloads of AIX 3.2.5 or earlier.. We recently lost our HDD running AIX 3.2.5 and need to reinstall but have no OS disk to complete.. Any help would be appreciated.. Thanks (4 Replies)
Discussion started by: rmsdp
4 Replies

4. Solaris

hardware assistance

Hoping someone can help clarify what I need. At present I have a Sun Ultra 2 with two ultrawide scsi cards and 2-12 drive multipacks (one multipack to one card, the other multipack to the other card), 2 Sun Ultra 10's, and a Sun E4500 with a differential scsi card connected to a half filled... (4 Replies)
Discussion started by: paulbryant
4 Replies

5. Shell Programming and Scripting

I need an assistance

I have a school project to create a shell program same as calendar i must create a txt file with celebrations with vi i know this but the problem is i don't know awk and grep. The object of object is to create a program who read a date an appear the celebration. Can you help me please !!!... (1 Reply)
Discussion started by: mytilini boy
1 Replies

6. UNIX for Advanced & Expert Users

URGENT,URGENT- Need help tape drive installation

Hi, I am trying to attach tape drive to sun V890 running Solaris 9 on it. I have installed HBA(qlogic) in slot 1 of 0-8 slots and booted the system. I do not see HBAin prtdiag output. The tape drive is not attached to HBA. The tape drive I am going to attach is Sony AIT3. 1.How can I make... (3 Replies)
Discussion started by: sriny
3 Replies

7. UNIX for Dummies Questions & Answers

Assistance needed.

the command "nawk" returns the error command cannot be found in my unix system. Is there a specific library i need to have to use this command? I tried, the whereis command and it returns nothing. if there is nothing to do, what command can i use to replace this nawk command? Appreciate some... (4 Replies)
Discussion started by: 12yearold
4 Replies

8. UNIX for Dummies Questions & Answers

Need Assistance

I have two questions I am struggling with... How do the programs p1, p2, and p3 need to handle their standard files so they can work like this: p1 | p2 | p3 ? What exactly is this command supposed to do? $ kill -QUIT %1 & This command below? $ sort -o emp.lst emp lst & Any... (1 Reply)
Discussion started by: yahoo14
1 Replies

9. Windows & DOS: Issues & Discussions

Urgent Need for Assistance: Triggering Windows bat files from UNIX

Hello, Is there a way to trigger a Windows bat file or program on a different machine from a different UNIX server using KSC file? I hope you can assist me with this. Thanks! (0 Replies)
Discussion started by: punyenye
0 Replies

Featured Tech Videos