However:
So yes, for the REGEX you need the double brackets.
BTW: bad behaviour example as i was running it as root
Edit: Yes, for anything more complex than a simple single yes/no requires a standard if-statement like:
BTW: The only 'place' i actualy use == (as it wont work properly with a single) is with PHP.
All of both the shells (sh,bash) i came across worked well with a single =.
EDIT2:
Just read (once more) the 'man bash', and beeing in the homework section i must say:
-> Better get used to use the proper syntax right from the start!
Given this one long stream of data (all one line):
<TransactionDetail><TransactionHeader><ErrorLogging>YES</ErrorLogging><HistoryLogging>YES</HistoryLogging><ErrorDetection>NO</ErrorD... (4 Replies)
Hi!
Suppose I am at a location xyz:/abc1/abc2/abc3
Is it possible to move to another location xyz:/mnl1/mnl2/mnl3
by some coding within a script? (5 Replies)
I'm just starting a 'serious' coding in UNIX, so what I need is to run a C code on UNIX, What do I have to install (app) prior to coding/running the code and how do I compile that code?
can I write my c code in UNIX or I need to have a visual studio for this? (7 Replies)
Hi,
I have very little knowledge with unix and pmcmd. I need help with a issue.
I have to see whether a file has been dropped in a particular location/path. If the file dropped I have to check the last modified time, which should be greater than 8pmEST the prior day. If the file has been... (4 Replies)
I have a file f1.txt that contains string:
f1.txt
aaa
bbb
ccc
...
I want to write code to search that each string in file f2.txt(this file contains 1000+line codes).
file f2.txt
..
..
....aaa...xyz..
...
...
...ppp...
(dots . can be characters ot blank spaces)
If particular... (2 Replies)
Unix script coding help?
i am trying to write a code that will display following menu to user:
(A) Add
(B) Subtract
(C) Multiply
(D) Divide
(E) Modulus
(F) Exponentiation
(G) Exit
Then ask user for choice (A-F). After taking users choice ask user for two numbers and
perform... (3 Replies)
Good afternoon everyone,
I am very new to UNIX shell scripting and I am trying to understand the following code. I know what it does but I need to modify it so it will allow me to pass a file name as *FILENAME*
Thank for any guidance offered.
if ] ; then
match=`expr "$file" :... (2 Replies)
Hi,
as I mentioned in this thread(https://www.unix.com/shell-programming-and-scripting/280737-awk-function-return-permutations-n-items-out-m.html), a helpful coding style may improve overall value and support for people who come here and want to learn things the participants from unix.com have... (2 Replies)
Discussion started by: stomp
2 Replies
LEARN ABOUT OSF1
tty
tty(1) General Commands Manual tty(1)NAME
tty - Returns pathname of terminal device
SYNOPSIS
tty [-s]
The tty command writes the full pathname of your terminal device to standard output. The tty command may also be used to determine if
standard input is a terminal.
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
tty: XCU5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
OPTIONS
Suppresses reporting the pathname.
The XCU specification states that -s option is obsolete and recommends the portable applications use test -t 0 instead of tty -s.
OPERANDS
None
DESCRIPTION
The command tty -s evaluates as TRUE if standard input is a display and FALSE if it is not.
[Tru64 UNIX] The file /dev/tty is a special file always refers to your controlling terminal, although it also may have another name like
/dev/console or /dev/tty2. To avoid writing undesirable output to an output file--for example, to write a prompt in a shell script to the
screen, while writing the response to the prompt to an output file--redirect standard output to /dev/tty.
NOTES
While the -s option is useful if only the exit code is wanted, it does not rely on any ability to form a valid pathname. For a portable
application you should use the command test -t 0.
EXIT STATUS
The following exit values are returned: Successful completion. Standard input is not a display. [Tru64 UNIX] Invalid options specified.
[Tru64 UNIX] An error occurred.
DIAGNOSTICS
[Tru64 UNIX] Your standard input is not a display and you did not specify the -s option.
EXAMPLES
To display full pathname of your terminal device, enter: tty To test whether or not the standard input is a terminal device, create a shell
script containing the following: if tty -s then echo 'Output is a display' else echo 'Output is not a display' fi
If the standard input is a terminal device, this displays the Output is a display message. If the standard input is not a terminal
device, it displays the Output is not a display message.
ENVIRONMENT VARIABLES
The following environment variables affect the execution of tty: Provides a default value for the internationalization variables that are
unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari-
ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value,
overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes
of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the for-
mat and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of
LC_MESSAGES.
FILES
Pseudodevice representing the user's controlling terminal.
SEE ALSO
Commands: stty(1), test(1)
Routines: ttyname(3)
Files: tty(7)
Standards: standards(5)tty(1)