Not a complicated one , this is a very simple bash stripping operations
base=${0##*/}
Normally $0 contains the name of the shell like bash or /bin/bash , this command
is used to strip the path if it is has.
base contains bash ( for ex )
link=${base#*[SK][0-9][0-9]}
This is used to strip the given string upto the pattern [SK][0-9][0-9]
for ex:
base=k12bash
then link contains bash only.
The first line takes the positional parameter 0 (thats the name the script is invoked with) and strips from the left all characters up to and including the last slash. So it simply does what basename $0 would do.
The second line takes $base and strips from the left all characters up to and including the first character S or K and then two digits.
So, if the script is called as /etc/rc3.d/S79do_something, then base would be set to S79do_something and link would be set to do_something.
I am writing one start up script on SLES10 and am including the header
### BEGIN INIT INFO
# Provides: backserver
# Required-Start: clientserver
# Should-Start:
# Required-Stop:
# Default-Start: 2 3 4 5 6
# Default-Stop: 0 1 2 6
# Short-Description: backserver
# Description: Start backserver
### END INIT INFO
#!/bin/bash
#
# Startup script for backserver
#
#
# description: backserver
# Source function library.
. /etc/rc.status
rc_reset
This backserver service along with clientserver service should start after system reboot.
But everytime I reboot the system backserver is not starting since clientserver has not yet started.
Since the links generated in/etc/init.d/rc5.d as
S01backserver
S01clientserver
and they are trying to get started in alphabetical order.
I want a way by which I can change the SXX values of the links.