cod

bourne

Determine If Shell Input is Coming From the Terminal or From a Pipe Determine If Shell Input is Coming From the Terminal or From a Pipe Working on a little script the other day I had the need to determine if the input to the script was coming from a pipe or from the terminal. Seems like a simple enough thing to determine but nothing jumped immediately to mind and a quick internet search didn't help much either. After a bit of pondering I came up with two solutions: the stat command and using information from the proc file system.
As you know the 'time' command run programs and summarize system resource usage. Here is a way how you can redirect 'time' command output to file. I would recomend you to go through this page to understand more about 'time' command. e.g. We are executing 'prog.sh' along with 'time' command. UNIX BASH scripting UNIX BASH scripting
Bashfully Yours, Gem Shortcuts
Bash Process Substitution In addition to the fairly common forms of input/output redirection the shell recognizes something called process substitution. Although not documented as a form of input/output redirection, its syntax and its effects are similar. The syntax for process substitution is: <(list) or >(list) where each list is a command or a pipeline of commands. Bash Process Substitution
Discover tput What is tput? The tput command initializes and manipulates your terminal session through the terminfo database. Using tput, you can alter several terminal capabilities, such as moving or altering the cursor, changing text properties, and clearing specific areas of the terminal screen. Back to top What is the terminfo database? Discover tput