04-10-2009
I just realized something that I didn't notice before. When I removed the "-e" option from the read command, both my previous solution and the suggested solution above worked fine. It look likes "read -e" outputs everything through stderr. Is that correct? Without the "-e" option, the backspace key doesn't work in the read statement. Is there something I am missing or is "read -e" the only way to allow the user to use a simple editor to input information to the script.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
In bash, I need to send the STDOUT and STDERR from a command to one file, and then just STDERR to another file. Doing one or the other using redirects is easy, but trying to do both at once is a bit tricky. Anyone have any ideas? (9 Replies)
Discussion started by: jshinaman
9 Replies
2. Shell Programming and Scripting
If I forget to set up stderr redirection on execution of a script, is there a way to set that redirection post-exec? In other words, if I have a script running and no errors are being logged... and then I remember that I forgot the 2>&1 on the script... can I turn it on after the fact?
...and... (1 Reply)
Discussion started by: jjinno
1 Replies
3. Shell Programming and Scripting
Friends
I have to redirect STDERR messages both to screen and also capture the same in a file.
2 > &1 | tee file works but it also displays the non error messages to file, while i only need error messages.
Can anyone help?? (10 Replies)
Discussion started by: vikashtulsiyan
10 Replies
4. Shell Programming and Scripting
% ls -ld /usr /foo
ls: /foo: No such file or directory
drwxr-xr-x 14 root wheel 512 May 18 02:49 /usr
% ls -ld /usr /foo 1>/dev/null/
/dev/null/: Not a directory.
% ls -ld /usr /foo 2>/dev/null/
/dev/null/: Not a directory.
^^Why why why doesn't this work for me. Furthermore, where is... (7 Replies)
Discussion started by: phpfreak
7 Replies
5. Shell Programming and Scripting
I dont know what I am doing wrong but I would like to redirect the stderr output to a file?
the specific command is this
time wget http://www.something.com/somefile.bin
All I want to see is time's output which is stderr so I can see how long the file download took. I've tried redirecting... (2 Replies)
Discussion started by: trey85stang
2 Replies
6. Shell Programming and Scripting
I'm not a complete novice at unix but I'm not all that advanced either. I'm hoping that someone with a little more knowledge than myself has the answer I'm looking for.
I'm writing a wrapper script that will be passed user commands from the cron...
Ex:
./mywrapper.sh "/usr/bin/ps -ef |... (1 Reply)
Discussion started by: sumgi
1 Replies
7. Shell Programming and Scripting
Hi,
I already searched through the forum and tried to find a answer for my problem but I didn't found a full working solution, thats way I start this new thread and hope, some can help out.
I wonder that I'm not able to find a working solution for the following scenario:
Working in bash I... (8 Replies)
Discussion started by: Boemm
8 Replies
8. Shell Programming and Scripting
I have to redirect STDERR messages both to screen and also capture the same in a file but STDOUT only to the same file.
I have searched in this formum for a solution, but something like
srcipt 3>&1 >&2 2>&3 3>&- | tee errs
doesn't work for me...
Has anyone an idea??? (18 Replies)
Discussion started by: thuranga
18 Replies
9. Shell Programming and Scripting
Hi folks
I need/want to redirect output (stdout, stderr) from an exec call to separate files. One for stderr only and two(!) different (!) ones for the combined output of stderr and stdout.
After some research and testing i got this so far :
(( exec ${command} ${command_parameters} 3>&1... (6 Replies)
Discussion started by: MDominok
6 Replies
10. UNIX for Beginners Questions & Answers
I know that
mmmmm 2> error.txt
will send the error message to the specified file instead of the screen. However, I have seen
>&2
in some scripts, and I can't get it to do anything. A source said it sends stdout and stderr to a file. What file?
Ubuntu 18.04.2; Xfce 4.12.3;... (11 Replies)
Discussion started by: Xubuntu56
11 Replies
CFGET(1) User Commands CFGET(1)
NAME
cfget - get values from a config file
SYNOPSIS
cfget [options] section/key
cfget [options] --dump=STYLE [section/key [section/key...]]
cfget [options] --template=STYLE [infile [outfile]]
DESCRIPTION
Get values from a config file.
cfget is a simple tool to read values from configuration files. It is useful, for example, to create configurable shellscripts or make-
files.
It can also be configured to support virtual configuration values that, if not present in the config file, are automatically computed from
the existing values. This makes it convenient, for example, to get a "duration" value from a configuration file that only contains a "start
date" and an "end date".
OPTIONS
--version
show program's version number and exit
-h, --help
show this help message and exit
-q, --quiet
quiet mode: only output fatal errors
-v, --verbose
verbose mode
--debug
verbose mode
-C file, --cfg=file
config file to read; the option can be given more than once to read more than one file. If missing, read a colon separated list from
the CFGET_CFG env variable.
-P file, --plugin=file
list of plugin files or directories to load. The option can be given more than once to read more than one file. If missing, read a
colon separated list from the CFGET_PLUGINS env variable.
-d name, --dump=name
dump the contents of the database using the given style. Use '--dump=list' for a list of available styles. If one or more paths are
provided in the command line, dump only those paths, otherwise dump all.
-t name, --template=name
read a template file, expand template placeholders using the configuration data and output the result. Use '--template=list' for a
list of available styles.
-f name, --format=name
use a custom configuration file format (default: ini). Use '--format=list' for a list of available formats. The CFGET_FORMAT envi-
ronment value, if defined, can be used to provide a different default value.
-r path, --root=path
restrict all work to values under the given path
EXAMPLES
# Get a key from a config file
cfget -C file.ini general/name
# More can be specified, they will be searched in order
cfget -C general.ini -C local.ini general/name
# Use a plugin to add virtual entries
cfget -C file.ini --plugin=virtual.py general/name
# A plugin can also a directory containing .py files
# and plugins can also be specified more than once
cfget -C file.ini --plugin=virtual.py --plugin=virtual/ general/name
# In a shellscript, you may want to use environment variables if you
# invoke cfget many times:
#!/bin/sh
CFGET_CFG=general.ini:local.ini
CFGET_PLUGINS=virtual.py:virtual/
START=`cfget general/start`
END=`cfget general/end`
DURATION=`cfget general/duration`
# Quick way to copy all config values to the environment
eval `cfget --dump=exports -C file.ini`
# Autoconf-style template substitution
cfget --template=autoconf -C file.ini script.in script
# Curly braces substitude literally
cfget -C file.ini "general/start_{general/type}"
# One can use simple expressions
cfget -C file.ini "general/start + general/duration"
cfget -C file.ini "round(general/age / 2)"
AUTHOR
cfget has been written by Enrico Zini <enrico@enricozini.org>.
cfget 0.15 July 2010 CFGET(1)