Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
81c03832
Commit
81c03832
authored
Dec 05, 1999
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix echo -n and read -r in scripts.
parent
60ae5ed0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
31 deletions
+52
-31
src/bin/scripts/createuser
src/bin/scripts/createuser
+20
-10
src/bin/scripts/dropdb
src/bin/scripts/dropdb
+15
-4
src/bin/scripts/droplang
src/bin/scripts/droplang
+1
-12
src/bin/scripts/dropuser
src/bin/scripts/dropuser
+16
-5
No files found.
src/bin/scripts/createuser
View file @
81c03832
...
...
@@ -8,7 +8,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.
1 1999/12/04 04:53:21
momjian Exp $
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.
2 1999/12/05 20:52:54
momjian Exp $
#
# Note - this should NOT be setuid.
#
...
...
@@ -24,6 +24,16 @@ PwPrompt=
Password
=
PSQLOPT
=
# Check for echo -n vs echo \c
if
echo
'\c'
|
grep
-s
c
>
/dev/null 2>&1
then
ECHO_N
=
"echo -n"
ECHO_C
=
""
else
ECHO_N
=
"echo"
ECHO_C
=
'\c'
fi
while
[
$#
-gt
0
]
do
...
...
@@ -92,19 +102,19 @@ fi
# Get missing user attributes
if
[
-z
"
$NewUser
"
]
;
then
echo
-n
"Enter name of user to add: "
read
-r
NewUser
$ECHO_N
"Enter name of user to add: "
$ECHO_C
read
NewUser
[
$?
-ne
0
]
&&
exit
1
fi
if
[
"
$PwPrompt
"
]
;
then
echo
-n
"Enter password for user
$NewUser
: "
read
-r
Password
$ECHO_N
"Enter password for user
$NewUser
: "
$ECHO_C
read
Password
fi
if
[
-z
"
$CanCreateDb
"
]
;
then
echo
-n
"Is the new user allowed to create databases? (y/n) "
read
-r
$ECHO_N
"Is the new user allowed to create databases? (y/n) "
$ECHO_C
read
REPLY
[
$?
-ne
0
]
&&
exit
1
if
[
$REPLY
=
"y"
-o
$REPLY
=
"Y"
]
;
then
CanCreateDb
=
t
...
...
@@ -114,8 +124,8 @@ if [ -z "$CanCreateDb" ]; then
fi
if
[
-z
"
$CanAddUser
"
]
;
then
echo
-n
"Shall the new user be allowed to create more new users? (y/n) "
read
-r
$ECHO_N
"Shall the new user be allowed to create more new users? (y/n) "
$ECHO_C
read
REPLY
[
$?
-ne
0
]
&&
exit
1
if
[
$REPLY
=
"y"
-o
$REPLY
=
"Y"
]
;
then
CanAddUser
=
t
...
...
@@ -142,4 +152,4 @@ if [ $? -ne 0 ]; then
exit
1
fi
exit
0
\ No newline at end of file
exit
0
src/bin/scripts/dropdb
View file @
81c03832
...
...
@@ -10,7 +10,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropdb,v 1.
1 1999/12/04 04:53:21
momjian Exp $
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropdb,v 1.
2 1999/12/05 20:52:54
momjian Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -20,6 +20,17 @@ PSQLOPT=
dbname
=
forcedel
=
t
# Check for echo -n vs echo \c
if
echo
'\c'
|
grep
-s
c
>
/dev/null 2>&1
then
ECHO_N
=
"echo -n"
ECHO_C
=
""
else
ECHO_N
=
"echo"
ECHO_C
=
'\c'
fi
while
[
$#
-gt
0
]
do
case
"
$1
"
in
...
...
@@ -75,8 +86,8 @@ fi
if
[
"
$forcedel
"
=
f
]
;
then
echo
"Database
\"
$dbname
\"
will be permanently deleted."
echo
-n
"Are you sure? (y/n) "
read
-r
$ECHO_N
"Are you sure? (y/n) "
$ECHO_C
read
REPLY
[
$?
-eq
1
]
&&
exit
1
[
"
$REPLY
"
!=
"y"
-a
"
$REPLY
"
!=
"Y"
]
&&
exit
0
...
...
@@ -89,4 +100,4 @@ if [ $? -ne 0 ]; then
exit
1
fi
exit
0
\ No newline at end of file
exit
0
src/bin/scripts/droplang
View file @
81c03832
...
...
@@ -8,7 +8,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.
1 1999/12/05 20:02:48
momjian Exp $
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.
2 1999/12/05 20:52:54
momjian Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -20,17 +20,6 @@ langname=
echo
=
list
=
# Check for echo -n vs echo \c
if
echo
'\c'
|
grep
-s
c
>
/dev/null 2>&1
then
ECHO_N
=
"echo -n"
ECHO_C
=
""
else
ECHO_N
=
"echo"
ECHO_C
=
'\c'
fi
# ----------
# Get options, language name and dbname
...
...
src/bin/scripts/dropuser
View file @
81c03832
...
...
@@ -8,7 +8,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.
1 1999/12/04 04:53:21
momjian Exp $
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.
2 1999/12/05 20:52:54
momjian Exp $
#
# Note - this should NOT be setuid.
#
...
...
@@ -18,6 +18,17 @@ CMDNAME=`basename $0`
PSQLOPT
=
forcedel
=
t
# Check for echo -n vs echo \c
if
echo
'\c'
|
grep
-s
c
>
/dev/null 2>&1
then
ECHO_N
=
"echo -n"
ECHO_C
=
""
else
ECHO_N
=
"echo"
ECHO_C
=
'\c'
fi
while
[
$#
-gt
0
]
do
case
"
$1
"
in
...
...
@@ -72,16 +83,16 @@ fi
# Prompt for username if missing
if
[
-z
"
$DelUser
"
]
;
then
echo
-n
"Enter name of user to delete: "
read
-r
NewUser
$ECHO_N
"Enter name of user to delete: "
$ECHO_C
read
NewUser
[
$?
-ne
0
]
&&
exit
1
fi
if
[
"
$forcedel
"
=
f
]
;
then
echo
"User
\"
$DelUser
\"
and any owned databases will be permanently deleted."
echo
-n
"Are you sure? (y/n) "
read
-r
$ECHO_N
"Are you sure? (y/n) "
$ECHO_C
read
REPLY
[
$?
-eq
1
]
&&
exit
1
[
"
$REPLY
"
!=
"y"
-a
"
$REPLY
"
!=
"Y"
]
&&
exit
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment