Fórum Ubuntu CZ/SK
Ubuntu pro osobní počítače => Software => Příkazový řádek a programování pro GNU/Linux => Téma založeno: NoWin 03 Listopadu 2009, 10:42:09
-
Nazdar, jakým příkazem (bash) se to dá udělat?
Mám třeba konfigurák /etc/init.d/rc...
...PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
# Un-comment the following for interactive debugging. Do not un-comment
# this for debugging a real boot process as no scripts will be executed.
# debug=echo
# Specify method used to enable concurrent init.d scripts.
# Valid options are 'none', 'startpar' and 'makefile'. To enable
# the concurrent boot option, the init.d script order must allow for
# concurrency. This is not the case with the default boot sequence in
# Debian as of 2008-01-20. Before enabling concurrency, one need to
# check the sequence values of all boot scripts, and make sure only
# scripts that can be started in parallel have the same sequence
# number, and that a scripts dependencies have a earlier sequence
# number. See the insserv package for a away to reorder the boot
# automatically to allow this.
CONCURRENCY=none
# Make sure the name survive changing the argument list
scriptname="$0"
umask 022
on_exit() {
echo "error: '$scriptname' exited outside the expected code flow."
}
trap on_exit EXIT # Enable emergency handler
# Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
trap ":" INT QUIT TSTP...
... a v něm chci změnit řádek "CONCURRENCY=none" na "CONCURRENCY=shell"
Mělo by to bejt citlivý na velikost písmen a mělo by si to všímat pouze výrazu CONCURRENCY=none a ne CONCURRENCY="none"
-
nepomohlo by neco na tento zpusob? (pokud tam mam chybu tak me omluvte)
sed "s/CONCURRENCY=none/CONCURRENCY=shell/g"
-
nepomohlo by neco na tento zpusob? (pokud tam mam chybu tak me omluvte)
sed "s/CONCURRENCY=none/CONCURRENCY=shell/g"
Jó, to je přesně ono!
Musel jsem to trošku poupravit (příkaz sed "s/CONCURRENCY=none/CONCURRENCY=shell/g" /etc/init.d/rc > /etc/init.d/rc ten soubor vyprázdnil, bez přesměrování se upravenej text zobrazil jen v Terminálu a na čtení manuálu je mi blbě), teď to vypadá takhle:
# mv /etc/init.d/rc /etc/init.d/rc.1
# sed "s/CONCURRENCY=none/CONCURRENCY=shell/g" /etc/init.d/rc.1 > /etc/init.d/rc
... a funguje to přesně tak, jak jsem si přál.
Ještě jednou mockrát dík!
K+
-
sed -i.zaloha 's/^CONCURRENCY=none$/CONCURRENCY=shell/' /etc/init.d/rc
-
sed -i.zaloha 's/^CONCURRENCY=none$/CONCURRENCY=shell/' /etc/init.d/rc
Jo, to je přesně ono, díky!!!