diff options
| author | Noriko Hosoi <nhosoi@redhat.com> | 2007-03-24 00:51:11 +0000 |
|---|---|---|
| committer | Noriko Hosoi <nhosoi@redhat.com> | 2007-03-24 00:51:11 +0000 |
| commit | 5e6fc4a1e77b0a00bf11c5797b2c987026906964 (patch) | |
| tree | da63241b0c70493599a3cdbfea674ad7543222c3 /ldap/admin/src/scripts | |
| parent | 82706f78cb737a55c2f904be9ff33fc0f3bfc6de (diff) | |
Resolves: #233027
Summary: make db2bak.pl & db2ldif.pl user more user-friendly (Comment #8)
Fixed problem: the command line fails to generate an output file name
when an empty suffix is passed like this: db2ldif -s ""
Diffstat (limited to 'ldap/admin/src/scripts')
| -rwxr-xr-x | ldap/admin/src/scripts/template-db2ldif.in | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/ldap/admin/src/scripts/template-db2ldif.in b/ldap/admin/src/scripts/template-db2ldif.in index 27f22bca..655a8416 100755 --- a/ldap/admin/src/scripts/template-db2ldif.in +++ b/ldap/admin/src/scripts/template-db2ldif.in @@ -14,14 +14,14 @@ export SHLIB_PATH make_ldiffile() { - nobe=0 + be="" while [ "$1" != "" ] do - if [ "$1" = '-a' ]; then + if [ "$1" = "-a" ]; then shift echo $1 return 1 - elif [ "$1" = '-n' ]; then + elif [ "$1" = "-n" ]; then shift if [ "$be" = "" ]; then be="$1" @@ -29,26 +29,28 @@ make_ldiffile() tmpbe="$be" be="${tmpbe}-$1" fi - elif [ "$1" = '-s' ]; then + elif [ "$1" = "-s" ]; then shift - rdn=`echo $1 | awk -F, '{print $1}'` - rdnval=`echo $rdn | awk -F= '{print $2}'` - if [ "$be" = "" ]; then - be="$rdnval" - else - tmpbe="$be" - be="${tmpbe}-$rdnval" + if [ "$1" != "" ]; then + rdn=`echo $1 | awk -F, '{print $1}'` + rdnval=`echo $rdn | awk -F= '{print $2}'` + if [ "$be" = "" ]; then + be="$rdnval" + else + tmpbe="$be" + be="${tmpbe}-$rdnval" + fi fi - elif [ "$1" = '-M' ]; then - nobe=1 + elif [ "$1" = "-M" ]; then + be="" fi shift done - if [ $nobe -eq 0 ]; then - echo {{LDIF-DIR}}/{{SERV-ID}}-${be}-`date +%Y_%m_%d_%H%M%S`.ldif - else + if [ "$be" = "" ]; then echo {{LDIF-DIR}}/{{SERV-ID}}-`date +%Y_%m_%d_%H%M%S`.ldif + else + echo {{LDIF-DIR}}/{{SERV-ID}}-${be}-`date +%Y_%m_%d_%H%M%S`.ldif fi return 0 } |
