[PATCH] Improve portability of pgweb/load_initial_data.sh - Mailing list pgsql-www

From Nils
Subject [PATCH] Improve portability of pgweb/load_initial_data.sh
Date
Msg-id 20211107164951.wxcyp7iar2s4mjkn@nixos
Whole thread Raw
Responses Re: [PATCH] Improve portability of pgweb/load_initial_data.sh  (Magnus Hagander <magnus@hagander.net>)
List pgsql-www
The shell script doesn't use bash extensions and bash may not be
available on all systems at that location.

If CDPATH is set, in certain cases, the call to cd can result in
unwanted behaviour.
---
 pgweb/load_initial_data.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pgweb/load_initial_data.sh b/pgweb/load_initial_data.sh
index fb16e70c..c419f298 100755
--- a/pgweb/load_initial_data.sh
+++ b/pgweb/load_initial_data.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 # We keep this in a separate script because using initial_data.xxx in django will overwrite
 # critical data in the database when running a 'syncdb'. We'd like to keep the ability to
@@ -8,7 +8,7 @@ echo WARNING: this may overwrite some data in the database with an initial set o
 echo 'Are you sure you want this (answer "yes" to overwrite)'
 read R
 
-cd $(dirname $0)
+CDPATH= cd $(dirname $0)
 
 if [ "$R" == "yes" ]; then
    find . -name data.json | xargs ../manage.py loaddata
-- 
2.31.1




pgsql-www by date:

Previous
From: Nils
Date:
Subject: [PATCH] Change text direction of documentation pages
Next
From: Nils
Date:
Subject: [PATCH] Fix inaccuracies in documentation