Search Results

Search: Posts Made By: MadeInGermany
145
Posted By MadeInGermany
Obviously the default timeout is too high. Add...
Obviously the default timeout is too high.
Add two lines to /etc/resolv.conf
options timeout:2
options attempts:2

These values will give a total delay of 2 * 2 = 4 seconds when the first DNS...
158
Posted By MadeInGermany
The -H is specific to GNU ps (Linux). It does...
The -H is specific to GNU ps (Linux).
It does an indentation (two spaces per hierarchy level) without any ASCII art. This is easy to post-process i.e. filter for the releavant parts.
158
Posted By MadeInGermany
Sorry, somehow my copy/paste left out a bunch of...
Sorry, somehow my copy/paste left out a bunch of lines.
Now I have corrected my original post.

--- Post updated at 11:24 ---

@nezabudka, the goal was to only show a relevant part of the...
158
Posted By MadeInGermany
[Tip] ptree for Linux
Unix (and Linux) uses a process tree that gives a natural security, by simple inheritance of attributes.

The following ptree script shows it. It runs on all Linux flavors.
Mostly useful for...
156
Posted By MadeInGermany
Yes, now you can see the respective links in the...
Yes, now you can see the respective links in the /etc/rc.d/rc?d/ directories.
First you can test your script with e.g.
service myscript stop
service myscript start
And if this works fine, do a...
156
Posted By MadeInGermany
rc.local is for compatibility with BSD Unix, not...
rc.local is for compatibility with BSD Unix, not well supported in Linux :(

In your start/stop script reate a dependency header - comments with certain keywords that belong to the LSB (Linux...
224
Posted By MadeInGermany
An not inititalized variable (or array element)...
An not inititalized variable (or array element) becomes 0 in number context, and "" in string context.
In this case, since 0 is the minimal possible string length, the 0 is perfect.

With two...
272
Posted By MadeInGermany
Add # sed '/^&@@10.10.10.10/ s/^/#/'...
Add #
sed '/^&@@10.10.10.10/ s/^/#/' /etc/rsyslog.confRemove #
sed '/^#&@@10.10.10.10/ s/^#//' /etc/rsyslog.confThe & is special in sed in the replacement string. This is avoided now.
But:
The $...
358
Posted By MadeInGermany
Can be done as a { } group. (Note: there must be...
Can be done as a { } group. (Note: there must be a semicolon or newline before the closing brace! And of cause spaces next to the [ ] { } )
if [ -f ./file2 ] && [ -f ./file3 ] && { [ -f ./file1 ]...
249
Posted By MadeInGermany
The latter suggestion is portable. Once defined...
The latter suggestion is portable.
Once defined as a function it becomes handy:
rightpad0() { printf "%s%0$((${1}-${#2}))d\n" "${2}"; }

rightpad0 9 2457
245700000
237
Posted By MadeInGermany
inotify (in Linux) is most efficient. You can...
inotify (in Linux) is most efficient.
You can also poll the file with fuser (or lsof).
file=tempfile
if [ ! -f $file ]
then
echo "$file is not present"
elif pids=$(fuser $file 2>/dev/null); [...
Forum: Linux 1 Week Ago
339
Posted By MadeInGermany
On Linux you can list your current "locale" with...
On Linux you can list your current "locale" with command
localeThe installed/available locales you can list with
locale -aThen set an appropriate locale, for example
export LC_ALL=es_ES.utf8and...
335
Posted By MadeInGermany
Or do all in bash - here is a well documented...
Or do all in bash - here is a well documented bash version:
#! /bin/bash
# bash v3 or higher

# file with list of items to find in modify_file
list_file=$1
# file for which a modified copy will...
581
Posted By MadeInGermany
You can save half of the memory by not storing in...
You can save half of the memory by not storing in arrays.
set -f # for safety: no filename generation
for i in $(cat elementen.txt)
do
for b in $(cat ITEMID.txt)
do
db2 -x "select...
572
Posted By MadeInGermany
If you have a rule like "cdc must appear at the...
If you have a rule like "cdc must appear at the beginning of the line and followed by a character",
then a simple RegularExpression does it:
perl -pe '/^cdc./ and s/^/#/' abc.txt
A -i option will...
305
Posted By MadeInGermany
The following does not work as intended: ...
The following does not work as intended:
set r=$r | tr "\n" " "
set r=$r | tr "\r" " "

set lwp=$lwp | tr "\n" " "
set lwp=$lwp | tr "\r"...
425
Posted By MadeInGermany
In awk you can strip the \r as follows awk ' ...
In awk you can strip the \r as follows
awk '
{ sub(/\r$/, "") }
...
Forum: Shell Programming and Scripting 2 Weeks Ago
371
Posted By MadeInGermany
Or sed 's/'"$TOKEN1"'\(.*\)'"$TOKEN2"'.*/\1/' ...
Or
sed 's/'"$TOKEN1"'\(.*\)'"$TOKEN2"'.*/\1/' "$INPUT1"

The point is, each $var must be within "quotes", so the shell does not do word splitting and filename generation.
Then it must be...
125
Posted By MadeInGermany
Try print instead of printf. The latter treats...
Try print instead of printf. The latter treats the first argument as a format string where % characters are special.
Forum: Shell Programming and Scripting 2 Weeks Ago
486
Posted By MadeInGermany
Perhaps yes, if $str1 doesn't have % characters.
Perhaps yes, if $str1 doesn't have % characters.
572
Posted By MadeInGermany
The following is a "safe" use of a tmp file -...
The following is a "safe" use of a tmp file - the && only on success will continue with the following command, and the cp leaves the inode/owner/group/permissions/linkage intact.
file=abc.txt...
363
Posted By MadeInGermany
In awk better print "quotes" around the filenames...
In awk better print "quotes" around the filenames because they become command arguments in sh where unquoted arguments are subject to substitutions.
{print "cp \"" FILENAME "\" /test/V_files/";...
Forum: Shell Programming and Scripting 2 Weeks Ago
486
Posted By MadeInGermany
Be careful with echo and with unquoted variables...
Be careful with echo and with unquoted variables in command arguments!
From [Tip] A better echo (https://www.unix.com/shell-programming-and-scripting/283413-tip-better-echo.html)
# Portable echo -e...
Forum: Shell Programming and Scripting 2 Weeks Ago
477
Posted By MadeInGermany
Assuming the input file has got many TKT records...
Assuming the input file has got many TKT records in sequence, an associative array is perfect:
awk '
NF>=3 {
A[$1]=(A[$1] ORS $2)
D[$1]=$3
}
END {
for (t in A) {
print "TKT:", t
...
1,134
Posted By MadeInGermany
The point is: set a real limit. "Unlimted"...
The point is: set a real limit.
"Unlimted" means a process is allowed to consume all system resources. And a buggy/wild/looping process could do so.
Showing results 1 to 25 of 500

 
All times are GMT -4. The time now is 01:13 PM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy