First off, I'd like to warn you: using backticks is a very, very, bad idea: they are outdated, they have a lot of drawbacks, they are only supported for backwards compatibility purposes (with some scripts from the seventies) and you should forget that they exist. Instead of
use
which does the same, only much better.
Quote:
Originally Posted by colinireland
reading in output from a terminal to a variable in the bash script.
terminals don't have output - only processes have output. If you start a process you can redirect its output to <stdout> and/or <stderr> (to your terminal, a file or the device another file descriptor points to). There is no way to redirect the output of a process you don't have started.
If you want to start an xterm and display the output of some process there, you have to:
1. create the terminal window
2. find out the device file attached to it
3. start your process and redirect its output to the device file in question.
More details: Unicode, Framebuffer. I tried to press Esc and then what should follow, letters or brackets, but seems not to work. Probably i do something wrong. If somebody is familiar with escape sequences in the console, how do you do that?
Thanks in advance. (4 Replies)
Hi,
I need to provide more than one character to "> /dev/tty" through terminal/keyboard input, I have this:
ok=false
while
do
echo " Enter r1 to reformat "
> /dev/tty
read choice
case $choice in
)
echo " bla bla bla "
;;
done
However, in this way,... (3 Replies)
I have a script.
#! /bin/bash
echo "Enter a word: "
read word
echo $word
That outputs like this..
Enter a word:
hello
hello
But how can i read on the same line the question is printed?
Like this..
Enter a word: hello
hello (2 Replies)
Hi
I am new to writing script and want to use a Bash Piped while-read and read from user input.
if something happens on server.log then do while loop or if something happend on user input then do while loop.
Pseudocode something like:
tail -n 3 -f server.log | while read serverline || read... (8 Replies)
My script needs to get some input from the user and go as a background process and run.
I have something like
read input.
do
while ...
if
..
fi
done
can i use nohup inside the script?? (7 Replies)
I'm a beginner to the Linux programming and trying my hands on some device driver examples while practising. The below code (a trimmed down version of tiny_tty.c from ldd3 book) loads perfectly using insmod and I'm able to see it in /proc/tty/drivers , /proc/modules and device nodes are getting... (1 Reply)
Dear Friends,
I am looking for a shell script to merge input files into one file .. here is my idea:
1st paramter would be outfile file (all input files content)
read all input files and merge them to input param 1
ex: if I pass 6 file names to the script then 1st file name as output file... (4 Replies)
Hi,
I'm using read in a script to prompt and receive input.
read -r -p "Do you also want to deploy folder? " response
This works fine, however, if I remotely execute the same script via ssh, at this point in the code, I don't see the message at all, but it waits for input. I could echo... (1 Reply)
Hi,
I am working on a script, which requests users to enter input.
Ex: read -p "Please enter your email id:" email
I don't want users skipping this entry, this has to be mandatory.I dont want to proceed without input.
I can do a check if variable $email is empty and proceed if not.But, i... (7 Replies)
In bash, you can do something like this:
#!/bin/bash
echo -n "What is your name? " > /dev/tty
read thename < /dev/tty
How can I do the same in python?
I have a python script that has the following content:
#!/usr/bin/python2.7
import getpass
import sys
import telnetlib
import... (2 Replies)
Discussion started by: SkySmart
2 Replies
LEARN ABOUT OPENSOLARIS
tcflow
tcflow(3C) Standard C Library Functions tcflow(3C)NAME
tcflow - suspend or restart the transmission or reception of data
SYNOPSIS
#include <termios.h>
int tcflow(int fildes, int action);
DESCRIPTION
The tcflow() function suspends transmission or reception of data on the object referred to by fildes, depending on the value of action. The
fildes argument is an open file descriptor associated with a terminal.
o If action is TCOOFF, output is suspended.
o If action is TCOON, suspended output is restarted.
o If action is TCIOFF, the system transmits a STOP character, which is intended to cause the terminal device to stop transmitting
data to the system.
o If action is TCION, the system transmits a START character, which is intended to cause the terminal device to start transmitting
data to the system.
The default on the opening of a terminal file is that neither its input nor its output are suspended.
Attempts to use tcflow() from a process which is a member of a background process group on a fildes associated with its controlling termi-
nal, will cause the process group to be sent a SIGTTOU signal. If the calling process is blocking or ignoring SIGTTOU signals, the process
is allowed to perform the operation, and no signal is sent.
RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.
ERRORS
The tcflow() function will fail if:
EBADF The fildes argument is not a valid file descriptor.
EINVAL The action argument is not a supported value.
ENOTTY The file associated with fildes is not a terminal.
The tcflow() function may fail if:
EIO The process group of the writing process is orphaned, and the writing process is not ignoring or blocking SIGTTOU.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-------------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-------------------------------+
|Interface Stability |Standard |
+-----------------------------+-------------------------------+
|MT-Level |MT-Safe, and Async-Signal-Safe |
+-----------------------------+-------------------------------+
SEE ALSO tcsendbreak(3C), attributes(5), standards(5), termio(7I)SunOS 5.11 14 Aug 2002 tcflow(3C)