standardize: read user input with [key] instead of <key>, [long input] instead of <INPUT>; echo path with [[path]]

This commit is contained in:
陆柯 2023-10-10 10:23:51 +08:00
parent c56fb5202f
commit 5253cac12b
26 changed files with 153 additions and 153 deletions

View File

@ -9,12 +9,12 @@ echo
while [ ! "$ISSUEMODE" ]
do
echo "=== Issue mode:"
echo " <s> for standalone"
echo " <w> for webroot"
echo " <n> for nginx"
echo " <a> for apache"
echo " <c> for challenge-alias"
echo " <d> for dnsapi"
echo " [s] for standalone"
echo " [w] for webroot"
echo " [n] for nginx"
echo " [a] for apache"
echo " [c] for challenge-alias"
echo " [d] for dnsapi"
read -p ">>> " ISSUEMODE
if [ "$ISSUEMODE" == 's' ]
then
@ -45,7 +45,7 @@ if [ "$ISSUEMODE" == 'd' ]
then
while [ ! "$DNSAPI" ]
do
echo "=== DNS API provider, <cf> for CloudFlare, <dp> for DNSPod/腾讯云, <ali> for Aliyun/阿里云:"
echo "=== DNS API provider, [cf] for CloudFlare, [dp] for DNSPod/腾讯云, [ali] for Aliyun/阿里云:"
read -p ">>> " DNSAPI_PROVIDER
if [ "$DNSAPI_PROVIDER" == 'cf' ]
then
@ -76,7 +76,7 @@ echo "***"
~/.acme.sh/acme.sh --issue -d $TARGET_HOSTNAME $ISSUEPARM $DNSAPI
echo
echo "=== Install certificates? <n> for no, <anything else> to install: "
echo "=== Install certificates? [n] for no, [anything else] to install: "
read -p ">>> " INSTALL_CERT
if [ "$INSTALL_CERT" != 'n' ]
then
@ -93,7 +93,7 @@ then
read -p ">>> " FULLCHAIN_FILE_PATH
done
echo
echo "=== Set reload command, <leave blank> for default to 'service nginx force-reload'"
echo "=== Set reload command, [leave blank] for default to 'service nginx force-reload'"
read -p ">>> " RELOADCMD
if [ ! "$RELOADCMD" ]
then

View File

@ -22,7 +22,7 @@ sed -i "s|/home/$NewUser:/bin/sh$|/home/$NewUser:/bin/bash|g" /etc/passwd
# Debian 9 default to empty
sed -i "s|/home/$NewUser:$|/home/$NewUser:/bin/bash|g" /etc/passwd
echo "=== Allow the new user [$NewUser] to sudo without password? <y> for yes, <anything else> for no"
echo "=== Allow the new user [[$NewUser]] to sudo without password? [y] for yes, [anything else] for no"
read -p ">>> " AllowSudo
if [ "$AllowSudo" == "y" ]
then

View File

@ -34,7 +34,7 @@ echo "=== Configure root home"
source /faronear/sysconfig/nixhome-config.sh /faronear/sysconfig/nixhome root
echo
echo "=== Change root password? <y> for yes, <anything else> for omit:"
echo "=== Change root password? [y] for yes, [anything else] for omit:"
read -p ">>> " ChangeRootPassword
if [ "$ChangeRootPassword" == 'y' ]
then
@ -66,7 +66,7 @@ then
echo
fi
echo "=== Set <hostname> or <leave blank> for no change"
echo "=== Set [new hostname] or [leave blank] for no change"
read -p ">>> " NewHostname
if [ $NewHostname ]
then
@ -93,7 +93,7 @@ chmod +x /faronear/autostart.sh
echo 'Autostart is set to /faronear/autostart.sh. Run "systemctl start/stop/status rc-local" to manage it.'
echo
echo "=== Configure locales: <y> for yes, <anything else> for no change:"
echo "=== Configure locales: [y] for yes, [anything else] for no change:"
read -p ">>> " ConfigLocales
if [ "$ConfigLocales" == 'y' ]
then
@ -101,7 +101,7 @@ then
fi
echo
echo "=== Add a new user [$NewUser]? <y> for yes, <anything else> for no change:"
echo "=== Add a new user [[$NewUser]]? [y] for yes, [anything else] for no change:"
read -p ">>> " AddNewUser
if [ "$AddNewUser" == 'y' ]
then
@ -109,13 +109,13 @@ then
source /faronear/sysconfig/nixhome-config.sh /faronear/sysconfig/nixhome $NewUser
echo
echo "=== Enable xfce autologin [/etc/lightdm/lightdm.conf]: <y> for autologin as [$NewUser] or <anything else> for no change:"
echo "=== Enable xfce autologin [/etc/lightdm/lightdm.conf]: [y] for autologin as [[$NewUser]] or [anything else] for no change:"
read -p ">>> " XfceAutologin
if [ "$XfceAutologin" == "y" ]
then
sed -i "s/^.*autologin-user=.*$/autologin-user=$NewUser/g" /etc/lightdm/lightdm.conf
sed -i "s/^.*autologin-user-timeout=.*$/autologin-user-timeout=0/g" /etc/lightdm/lightdm.conf
echo "--- Successfully configured autologin as $NewUser"
echo "--- Successfully configured autologin as [[$NewUser]]"
else
echo '--- Nothing changed.'
fi

View File

@ -3,7 +3,7 @@ if [ "$1" ]
then
DOCKERUSER=$1
else
echo "Enter the <user name> or <leave blank> for default to '`whoami`'"
echo "Enter the [user name] or [leave blank] for default to '`whoami`'"
read -p ">>> " DOCKERUSER
if [ ! "$DOCKERUSER" ]
then

View File

@ -6,7 +6,7 @@
# 安装自带版本 apt install docker.io && apt install docker-compose
# sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
echo "=== Choose docker source: <a> 阿里云, <z> 中科大, <leave blank> for default"
echo "=== Choose docker source: [a] 阿里云, [z] 中科大, [leave blank] for default"
read -p ">>> " DOCKER_SOURCE
if [ "$DOCKER_SOURCE" = 'a' ]
then
@ -48,7 +48,7 @@ docker compose version
# sudo curl -L $COMPOSE_URL/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
# sudo chmod +x /usr/local/bin/docker-compose
echo "=== Enter <y> to 配置中国加速镜像源 /etc/docker/daemon.json, <anything else> for no mirror:"
echo "=== Enter [y] to 配置中国加速镜像源 /etc/docker/daemon.json, [anything else] for no mirror:"
read -p ">>> " DOCKER_MIRROR
if [ "$DOCKER_MIRROR" = 'y' ]
then
@ -61,7 +61,7 @@ then
echo '] }' >> /etc/docker/daemon.json
fi
echo "=== 启动docker服务<y> for yes, <anything else> for no"
echo "=== 启动docker服务[y] for yes, [anything else] for no"
read -p ">>> " StartDockerDaemon
if [ "$StartDockerDaemon" = 'y' ]
then

View File

@ -6,7 +6,7 @@ if [ $1 ]
then
VERSION=$1
else
echo "=== Enter geth <VERSION> or <leave blank> for default $defaultVERSION"
echo "=== Enter geth [version number] or [leave blank] for default $defaultVERSION"
read -p ">>> " VERSION
if [ ! "$VERSION" ]
then

View File

@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" (
set FONPATH=%1
) else (
echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%]
echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" (
set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" (
@ -20,44 +20,44 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter <fonpath> or leave <blank> for default to '.'
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> "
echo;
if "" == "%FONPATH%" (
set FONPATH=.
set FONPATH=%CD%
)
)
)
if not exist "%FONPATH%" (
echo ××× [%FONPATH%] not exist! Exit now. ***
echo ××× [[%FONPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ FONPATH = %FONPATH%
)
echo === Enter [path to .gitignore] or leave [blank] for default to '.'
set /p GITIGNOREPATH=">>> "
echo;
if "" == "%GITIGNOREPATH%" (
set GITIGNOREPATH=.
)
if not exist "%GITIGNOREPATH%" (
echo ××× [%GITIGNOREPATH%] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ GITIGNOREPATH = %GITIGNOREPATH%
echo √√√ FONPATH = [[%FONPATH%]]
)
pushd %FONPATH%
echo *** Starting from [%CD%] ***
echo *** Starting from [[%CD%]] ***
echo;
echo === Enter [path to .gitignore] or [leave blank] for default to [[%CD%]]
set /p GITIGNOREPATH=">>> "
echo;
if "" == "%GITIGNOREPATH%" (
set GITIGNOREPATH=%CD%
)
if not exist "%GITIGNOREPATH%" (
echo ××× [[%GITIGNOREPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ GITIGNOREPATH = [[%GITIGNOREPATH%]]
)
for /d /r %%r in (*) do (
@REM @ if not "%%r" == ".vscode" (
echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\.gitignore" (
pushd "%%r"
echo ---- updating .gitignore in [%%r] ----
echo ---- updating .gitignore in [[%%r]] ----
copy %GITIGNOREPATH%\.gitignore %%r\
echo;
popd

View File

@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" (
set FONPATH=%1
) else (
echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%]
echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" (
set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" (
@ -20,37 +20,37 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter <fonpath> or leave <blank> for default to '.'
echo === Enter [start path]> or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> "
echo;
if "" == "%FONPATH%" (
set FONPATH=.
set FONPATH=%CD%
)
)
)
if not exist "%FONPATH%" (
echo ××× [%FONPATH%] not exist! Exit now. ***
echo ××× [[%FONPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ FONPATH = %FONPATH%
echo √√√ FONPATH = [[%FONPATH%]]
)
pushd %FONPATH%
echo *** Starting from [%CD%] ***
echo *** Starting from [[%CD%]] ***
echo;
@ if "%2" == "hier" (
@REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd )
for /d %%o in (*) do (
@ if not "%%o" == ".vscode" (
echo ======== entering [%FONPATH%\%%o] ========
echo ======== entering [[%FONPATH%\%%o]] ========
echo;
pushd %%o
for /d %%g in (*) do (
if exist "%%g\.git" (
pushd %%g
echo ---- git pulling [%FONPATH%\%%o\%%g] ----
echo ---- git pulling [[%FONPATH%\%%o\%%g]] ----
git pull --all
echo;
popd
@ -65,7 +65,7 @@ echo;
echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\.git" (
pushd "%%r"
echo ---- git pulling [%%r] ----
echo ---- git pulling [[%%r]] ----
git pull --all
echo;
popd

View File

@ -5,25 +5,25 @@ then
FONPATH=$1
else
echo ""
echo "=== Enter <fonpath> or leave <blank> for default to '.'"
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " FONPATH
echo ""
if [ ! "$FONPATH" ]
then
FONPATH=.
FONPATH=`pwd`
fi
fi
if [ ! -d "$FONPATH" ]
then
echo "××× <$FONPATH> not exist! Exit now. ***"
echo "××× [[$FONPATH]] not exist! Exit now. ***"
exit
else
echo "√√√ FONPATH = $FONPATH"
echo "√√√ FONPATH = [[$FONPATH]]"
fi
pushd $FONPATH
echo "*** Starting from [`pwd`] ***"
echo "*** Starting from [[`pwd`]] ***"
echo ""
if [ "$2" == 'hier' ]
@ -31,14 +31,14 @@ then
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v 'node_modules' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do
echo "======== entering [$FONPATH/$org] ========"
echo "======== entering [[$FONPATH/$org]] ========"
echo ""
cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格
do
if [ -d "$repo/.git" ]
then
echo "---- git pulling [`pwd`/$repo] ----"
echo "---- git pulling [[`pwd`/$repo]] ----"
cd "$repo"
git pull --all
echo ""
@ -52,7 +52,7 @@ else
do
if [ -d "$repo/.git" ]
then
echo "---- git pulling [$repo] ----"
echo "---- git pulling [[$repo]] ----"
pushd "$repo"
git pull --all
echo ""

View File

@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" (
set FONPATH=%1
) else (
echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%]
echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" (
set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" (
@ -20,24 +20,24 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter <fonpath> or leave <blank> for default to '.'
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> "
echo;
if "" == "%FONPATH%" (
set FONPATH=.
set FONPATH=%CD%
)
)
)
if not exist "%FONPATH%" (
echo ××× [%FONPATH%] not exist! Exit now. ***
echo ××× [[%FONPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ FONPATH = %FONPATH%
echo √√√ FONPATH = [[%FONPATH%]]
)
pushd %FONPATH%
echo *** Starting from [%CD%] ***
echo *** Starting from [[%CD%]] ***
echo;
echo === Enter [commit message] or [leave blank] for default to 'updated'
@ -51,13 +51,13 @@ echo;
@REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd )
for /d %%o in (*) do (
@ if not "%%o" == ".vscode" (
echo ======== entering [%FONPATH%\%%o] ========
echo ======== entering [[%FONPATH%\%%o]] ========
echo;
pushd "%%o"
for /d %%g in (*) do (
if exist %%g\.git (
pushd "%%g"
echo ---- git commit and push [%FONPATH%\%%o\%%g] ----
echo ---- git commit and push [[%FONPATH%\%%o\%%g]] ----
git add . && git commit -m "%COMMIT_MESSAGE%" && git push
echo;
popd
@ -72,7 +72,7 @@ echo;
echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\.git" (
pushd "%%r"
echo ---- git commit and push [%%r] ----
echo ---- git commit and push [[%%r]] ----
git add . && git commit -m "%COMMIT_MESSAGE%" && git push
echo;
popd

View File

@ -5,28 +5,28 @@ then
FONPATH=$1
else
echo ""
echo "=== Enter <fonpath> or leave <blank> for default to '.'"
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " FONPATH
echo ""
if [ ! "$FONPATH" ]
then
FONPATH=.
FONPATH=`pwd`
fi
fi
if [ ! -d "$FONPATH" ]
then
echo "××× <$FONPATH> not exist! Exit now. ***"
echo "××× [[$FONPATH]] not exist! Exit now. ***"
exit
else
echo "√√√ FONPATH = $FONPATH"
echo "√√√ FONPATH = [[$FONPATH]]"
fi
pushd $FONPATH
echo "*** Starting from [`pwd`] ***"
echo "*** Starting from [[`pwd`]] ***"
echo ""
echo "=== Enter <commit message> or <leave blank> for default to 'updated'"
echo "=== Enter [commit message] or [leave blank] for default to 'updated'"
read -p ">>> " COMMIT_MESSAGE
if [ ! "$COMMIT_MESSAGE" ]
then
@ -34,7 +34,7 @@ then
fi
echo ""
echo "=== Enter <h> for hierarchical, <r> for recursive, <anything else> for listing"
echo "=== Enter [h] for hierarchical, [r] for recursive, [anything else] for listing"
read -p ">>> " ACTION_TYPE
if [ "$ACTION_TYPE" == 'h' ]
@ -42,14 +42,14 @@ then
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v 'node_modules' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do
echo "======== entering [$FONPATH/$org] ========"
echo "======== entering [[$FONPATH/$org]] ========"
echo ""
cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格
do
if [ -d "$repo/.git" ]
then
echo "---- git commit & push [`pwd`/$repo] ----"
echo "---- git commit & push [[`pwd`/$repo]] ----"
pushd "$repo"
git add . && git commit -m "$COMMIT_MESSAGE" && git push
echo ""
@ -64,7 +64,7 @@ then
do
if [ -d "$repo/.git" ]
then
echo "---- git commit & push [$repo] ----"
echo "---- git commit & push [[$repo]] ----"
pushd "$repo"
git add . && git commit -m "$COMMIT_MESSAGE" && git push
echo ""

View File

@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" (
set FONPATH=%1
) else (
echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%]
echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" (
set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" (
@ -23,21 +23,21 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
)
if not exist %FONPATH% (
echo ××× [%FONPATH%] not exist! Exit now. ***
echo ××× [[%FONPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ FONPATH = %FONPATH%
echo √√√ FONPATH = [[%FONPATH%]]
)
pushd %FONPATH%
echo *** Current path = [%CD%] ***
echo *** Current path = [[%CD%]] ***
@REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd )
for /d %%o in (*) do (
@REM windows的链接文件会造成路径错误从而终止该循环从而导致下一轮乃至所有循环的工作目录错误。因此要过滤掉 .vscode 这个符号链接目录。
if not %%o == .vscode (
echo entering [%FONPATH%\%%o]
echo entering [[%FONPATH%\%%o]]
pushd %%o
for /d %%g in (*) do (
if exist %%g\.git (

View File

@ -5,31 +5,31 @@ then
FONPATH=$1
else
echo ""
echo "=== Enter <fonpath> or leave <blank> for default to '.'"
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " FONPATH
echo ""
if [ ! "$FONPATH" ]
then
FONPATH=.
FONPATH=`pwd`
fi
fi
if [ ! -d "$FONPATH" ]
then
echo "××× <$FONPATH> not exist! Exit now. ***"
echo "××× [[$FONPATH]] not exist! Exit now. ***"
exit
else
echo "√√√ FONPATH = $FONPATH"
echo "√√√ FONPATH = [[$FONPATH]]"
fi
pushd $FONPATH
echo "*** Current path = [`pwd`] ***"
echo "*** Starting from [[`pwd`]] ***"
echo ""
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v '=' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do
echo "======== entering [$FONPATH/$org] ========"
echo "======== entering [[$FONPATH/$org]] ========"
echo ""
cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格
@ -37,13 +37,13 @@ do
if [ -d "$repo/.git" ]
then
cd "$repo"
# echo " changing repo url to [$FONPATH/$org/$repo]"
# echo " changing repo url to [[$FONPATH/$org/$repo]]"
# git remote remove origin
# git remote add origin https://git.faronear.org/$org/$repo
# git pull
# git branch --set-upstream-to=origin/main main
# git pull
echo "---- renaming branch master to main for [`pwd`/$repo] ----"
echo "---- renaming branch master to main for [[`pwd`/$repo]] ----"
git branch -m master main
git push -u origin main
git push origin :master

View File

@ -3,14 +3,14 @@
echo "in [REPOROOT]/*/*/hooks/[pre-receive.d|post-receive.d|update.d]/gitea, path is hard-coded in full such as `/faronear/git/gitea/gitea hook --config=/faronear/git/gitea/custom/conf/app.ini`, you need to replace it if the path is changed."
echo "[20230305] noticed that gitea 1.18.5 default is `/usr/local/bin/gitea hook --config=/data/gitea/conf/app.ini`"
echo "Enter <old hook path> or <leave blank> for default '/faronear/git/gitea/gitea':"
echo "Enter [old hook path] or [leave blank] for default '/faronear/git/gitea/gitea':"
read -p ">>> " OLDPATH
if [ ! "$OLDPATH"]
then
OLDPATH=/faronear/git/gitea/gitea
fi
echo "Enter <new hook path> or <leave blank> for default '/usr/local/bin/gitea': "
echo "Enter [new hook path] or [leave blank] for default '/usr/local/bin/gitea': "
read -p ">> " NEWPATH
if [ ! "$NEWPATH" ]
then

View File

@ -6,7 +6,7 @@ if [ $1 ]
then
VERSION=$1
else
echo "=== Enter kubo <VERSION> or <leave blank> for default $defaultVERSION"
echo "=== Enter kubo [version number] or [leave blank] for default $defaultVERSION"
read -p ">>> " VERSION
if [ ! $VERSION ]
then

View File

@ -23,7 +23,7 @@ else
echo ""
if [ ! -d "$NIXHOME" ]
then
echo "××× nixhome path [$NIXHOME] not available! Exit now. ×××"
echo "××× nixhome path [[$NIXHOME]] not available! Exit now. ×××"
exit
fi
fi
@ -50,7 +50,7 @@ then
homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore"
echo
echo "=== Copy or link scripts? <l> to link, <c> to copy, <g> to git import, <anything else> to omit:"
echo "=== Copy or link scripts? [l] to link, [c] to copy, [g] to git import, [anything else] to omit:"
read -p ">>> " CopyOrLinkScripts
if [ "$CopyOrLinkScripts" == 'l' ]
then
@ -60,7 +60,7 @@ then
then
mv $homescript $homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)
fi
echo "--- Linking $NIXHOME/$homescript to $HomePath/$homescript ..."
echo "--- Linking [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..."
ln -s $NIXHOME/$homescript ./
done
elif [ "$CopyOrLinkScripts" == 'c' ]
@ -71,7 +71,7 @@ then
then
mv $homescript $homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)
fi
echo "--- Copying $NIXHOME/$homescript to $HomePath/$homescript ..."
echo "--- Copying [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..."
cp -r $NIXHOME/$homescript ./
done
elif [ "$CopyOrLinkScripts" == 'g' ]
@ -108,17 +108,17 @@ then
mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup-$(date -u +%Y%m%dT%H%M%Sutc)
fi
echo "=== Append or link or omit [$HomePath/.ssh/authorized_keys] to config ssh server? <a> for append, <l> for link, <anything else> for omit:"
echo "=== Append or link or omit [[$HomePath/.ssh/authorized_keys]] to config ssh server? [a] for append, [l] for link, [anything else] for omit:"
read -p ">>> " CopyOrLinkOrOmitAuthorizedKeys
if [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'l' ]
then
echo "--- Linking $NIXHOME/authorized_keys to $HomePath/.ssh/authorized_keys ..."
echo "--- Linking [[$NIXHOME/authorized_keys]] to [[$HomePath/.ssh/authorized_keys]] ..."
ln -s $NIXHOME/.ssh/authorized_keys $HomePath/.ssh/authorized_keys
sudo chmod 644 $HomePath/.ssh/authorized_keys # 确保其他用户能读取 nixhome/.ssh/authorized_keys
elif [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'a' ]
then
echo "--- Copying $NIXHOME/authorized_keys to $HomePath/.ssh/authorized_keys ..."
echo "--- Copying [[$NIXHOME/authorized_keys]] to [[$HomePath/.ssh/authorized_keys]] ..."
cat $NIXHOME/.ssh/authorized_keys >> $HomePath/.ssh/authorized_keys
chmod 600 $HomePath/.ssh/authorized_keys
fi
@ -129,5 +129,5 @@ then
popd
else
echo "!!! Not existing $HomePath, please try again."
echo "!!! Not found [[$HomePath]], please try again."
fi

View File

@ -8,7 +8,7 @@ if [ $1 ]
then
VERSION=$1
else
echo "=== Enter <nodejs version> or 'tools' or <leave blank> for default $defaultVERSION"
echo "=== Enter [nodejs version] or [leave blank] for default $defaultVERSION, enter [tools] to install C++ build tools"
read -p ">>> " VERSION
if [ ! $VERSION ]
then

View File

@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" (
set FONPATH=%1
) else (
echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%]
echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" (
set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" (
@ -20,38 +20,38 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter <fonpath> or leave <blank> for default to '.'
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> "
echo;
if "" == "%FONPATH%" (
set FONPATH=.
set FONPATH=%CD%
)
)
)
if not exist "%FONPATH%" (
echo ××× [%FONPATH%] not exist! Exit now. ***
echo ××× [[%FONPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ FONPATH = %FONPATH%
echo √√√ FONPATH = [[%FONPATH%]]
)
pushd %FONPATH%
echo *** Starting from [%CD%] ***
echo *** Starting from [[%CD%]] ***
echo;
@ if "%2" == "hier" (
@REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do if exist %%d/package.json ( pushd %%d & echo --- npm booting: %%d ... & npm run boot & popd ) ) & popd )
for /d %%o in (*) do (
@ if not "%%o" == ".vscode" (
echo ======== entering [%FONPATH%\%%o] ========
echo ======== entering [[%FONPATH%\%%o]] ========
echo;
pushd %%o
for /d %%g in (*) do (
@ if exist "%%g\package.json" (
findstr "\"boot\"" %%g\package.json >NUL && (
pushd %%g
echo ---- npm booting [%FONPATH%\%%o\%%g] ----
echo ---- npm booting [[%FONPATH%\%%o\%%g]] ----
npm run boot
echo;
popd
@ -68,7 +68,7 @@ echo;
if exist "%%r\package.json" (
findstr "\"boot\"" "%%r\package.json" >NUL && (
pushd %%r
echo ---- npm booting [%FONPATH%\%%r] ----
echo ---- npm booting [[%FONPATH%\%%r]] ----
npm run boot
echo;
popd

View File

@ -5,25 +5,25 @@ then
FONPATH=$1
else
echo ""
echo "=== Enter <fonpath> or leave <blank> for default to '.'"
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " FONPATH
echo ""
if [ ! "$FONPATH" ]
then
FONPATH=.
FONPATH=`pwd`
fi
fi
if [ ! -d "$FONPATH" ]
then
echo "××× <$FONPATH> not exist! Exit now. ***"
echo "××× [[$FONPATH]] not exist! Exit now. ***"
exit
else
echo "√√√ FONPATH = $FONPATH"
echo "√√√ FONPATH = [[$FONPATH]]"
fi
pushd $FONPATH
echo "*** Starting from [`pwd`] ***"
echo "*** Starting from [[`pwd`]] ***"
echo ""
if [ "$2" == 'hier' ]
@ -31,17 +31,17 @@ then
# for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。
ls -F | grep '/$' | grep -v '=' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名
do
echo "======== entering [$FONPATH/$org] ========"
echo "======== entering [[$FONPATH/$org]] ========"
echo ""
cd "$org";
for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格
do
if ( [ -f "$repo/package.json" ] && grep -q '"boot"' "$repo/package.json" )
then
echo "<<<< npm booting: [$org/$repo] <<<<"
echo "<<<< npm booting: [[$org/$repo]] <<<<"
cd "$repo"
npm run boot
echo ">>>> npm booted: [$org/$repo] >>>>"
echo ">>>> npm booted: [[$org/$repo]] >>>>"
echo ""
cd ..
fi
@ -54,12 +54,12 @@ else
if ( [ -f "$repo/package.json" ] && grep -q '"boot"' "$repo/package.json" )
then
echo ""
echo "---- npm booting: [$repo] ----"
echo "---- npm booting: [[$repo]] ----"
echo ""
pushd "$repo"
npm run boot
echo ""
echo "---- npm booted: [$repo] ----"
echo "---- npm booted: [[$repo]] ----"
echo ""
popd
fi

View File

@ -15,24 +15,24 @@ set FONPATH=
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter <fonpath> or leave <blank> for default to '.'
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> "
echo;
if "" == "%FONPATH%" (
set FONPATH=.
set FONPATH=%CD%
)
)))
)
if not exist "%FONPATH%" (
echo ××× [%FONPATH%] not exist! Exit now. ***
echo ××× [[%FONPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ FONPATH = %FONPATH%
echo √√√ FONPATH = [[%FONPATH%]]
)
pushd %FONPATH%
echo *** Starting from [%CD%] ***
echo *** Starting from [[%CD%]] ***
echo;
for /d /r %%r in (*) do (
@ -40,7 +40,7 @@ for /d /r %%r in (*) do (
echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\node_modules" (
pushd "%%r"
echo ---- Deleting [%FONPATH%\%%r] ----
echo ---- Deleting [[%FONPATH%\%%r]] ----
rd /s /q node_modules
echo;
popd

View File

@ -1,6 +1,6 @@
#!/bin/bash
echo "=== rclone <i> to install, <s> to sync, <c> to copy, <w> to web gui"
echo "=== rclone [i] to install, [s] to sync, [c] to copy, [w] to web gui"
read -p ">>> " ACTION_TYPE
if [ "$ACTION_TYPE" = 'i' ]
then
@ -23,7 +23,7 @@ then
echo "*****************************"
echo "rclone $RC_CMD $SOURCE_PATH $TARGET_PATH -P -L --create-empty-src-dirs --exclude=._* --exclude=.DS_Store --exclude={node_modules/,.deploy_git/,unpackage/,$EXCLUDING}"
echo "*****************************"
echo "Starting? <y> for yes, <anything else> for quit"
echo "Starting? [y] for yes, [anything else] for quit"
read -p ">>> " YES_OR_NOT
if [ "$YES_OR_NOT" = 'y' ]
then

View File

@ -2,7 +2,7 @@ if [ $1 ]
then
NewHostname=$1
else
echo "=== Set <hostname> or <leave blank> for no change"
echo "=== Set [new hostname] or [leave blank] for no change"
read -p ">>> " NewHostname
fi

View File

@ -2,7 +2,7 @@ echo "***************************************"
echo "find \$FOLDER -mindepth \$MINDEPTH -maxdepth \$MAXDEPTH -type d_f_l -name \"\$PATTERN\" | while read item; do echo \"\$item\"; done"
echo "***************************************"
echo "To find in which path? Enter <path> or <leave blank> for the current path:"
echo "To find in which path? Enter [start path] or [leave blank] for the current path:"
read -p ">>> " FIND_FOLDER
if [ ! "$FIND_FOLDER" ]
then
@ -20,21 +20,21 @@ then
MAXDEPTH_CLAUSE="-mindepth $MAXDEPTH"
fi
echo "To find file or directory? <f> for file, <d> for directory, <l> for link, <leave blank> for all:"
echo "To find file or directory? [f] for file, [d] for directory, [l] for link, [leave blank] for all:"
read -p ">>> " FIND_TYPE
if [ "$FIND_TYPE" ]
then
FIND_TYPE_CLAUSE="-type $FIND_TYPE"
fi
echo "To match pattern: <pattern> (e.g. '._*', '.*.js') or or <leave blank> for all:"
echo "To match pattern: [regex pattern] (e.g. '._*', '.*.js') or or [leave blank] for all:"
read -p ">>> " FIND_PATTERN
if [ ! "$FIND_PATTERN" ]
then
FIND_PATTERN="*"
fi
echo "To do something on each: <command> or <leave blank> for 'echo':"
echo "To do something on each: [command line] or [leave blank] for 'echo':"
read -p ">>> " FIND_ACTION
if [ ! "$FIND_ACTION" ]
then

View File

@ -3,7 +3,7 @@ echo "deb [arch=amd64 signed-by=/usr/share/keyrings/seafile-keyring.asc] https:/
sudo apt update
sudo apt install -y seafile-cli
echo "To initialze the client, create a settings folder <path> or <leave blank> for default '~/seafile-client'"
echo "To initialze the client, create a settings folder at [settings path] or [leave blank] for default '~/seafile-client'"
read -p ">>> " SETTINGS_FOLDER
if [ ! $SETTINGS_FOLDER ]
then

View File

@ -10,7 +10,7 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
@ if not "" == "%1" (
set FONPATH=%1
) else (
echo *** Testing Path [%FONPATH1%] [%FONPATH2%] [%FONPATH3%]
echo *** Testing Path [[%FONPATH1%]] [[%FONPATH2%]] [[%FONPATH3%]]
if exist "%FONPATH1%" (
set FONPATH=%FONPATH1%
) else if exist "%FONPATH2%" (
@ -20,43 +20,43 @@ set FONPATH3=%HOMEDRIVE%%HOMEPATH%\faronear
) else (
echo ××× none of the testing path is valid.
echo;
echo === Enter <fonpath> or leave <blank> for default to '.'
echo === Enter [start path] or [leave blank] for default to [[%CD%]]
set /p FONPATH=">>> "
echo;
if "" == "%FONPATH%" (
set FONPATH=.
set FONPATH=%CD%
)
)
)
if not exist "%FONPATH%" (
echo ××× [%FONPATH%] not exist! Exit now. ***
echo ××× [[%FONPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ FONPATH = %FONPATH%
echo √√√ FONPATH = [[%FONPATH%]]
)
echo === Enter [path to seafile-ignore.txt] or leave [blank] for default to '.'
echo === Enter [path to seafile-ignore.txt] or leave [blank] for default to [[%CD%]]
set /p SFIGNOREPATH=">>> "
echo;
if "" == "%SFIGNOREPATH%" (
set SFIGNOREPATH=.
set SFIGNOREPATH=%CD%
)
if not exist "%SFIGNOREPATH%" (
echo ××× [%SFIGNOREPATH%] not exist! Exit now. ***
echo ××× [[%SFIGNOREPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ SFIGNOREPATH = %SFIGNOREPATH%
echo √√√ SFIGNOREPATH = [[%SFIGNOREPATH%]]
)
pushd %FONPATH%
echo *** Starting from [%CD%] ***
echo *** Starting from [[%CD%]] ***
echo;
for /d /r %%r in (*) do (
@REM @ if not "%%r" == ".vscode" (
echo "%%r" | findstr "node_modules uni_modules .deploy_git .git .svn .vscode unpackage _webroot _logstore _datasotre _archive _filestore _ssl" >NUL || (
if exist "%%r\.git" (
echo ---- updating seafile-ignore.txt in [%%r] ----
echo ---- updating seafile-ignore.txt in [[%%r]] ----
copy %SFIGNOREPATH%\seafile-ignore.txt %%r\
echo;
)

View File

@ -5,25 +5,25 @@ then
FONPATH=$1
else
echo ""
echo "=== Enter <fonpath> or leave <blank> for default to '.'"
echo "=== Enter [start path] or [leave blank] for default to [[`pwd`]]"
read -p ">>> " FONPATH
echo ""
if [ ! "$FONPATH" ]
then
FONPATH=.
FONPATH=`pwd`
fi
fi
if [ ! -d "$FONPATH" ]
then
echo "××× <$FONPATH> not exist! Exit now. ***"
echo "××× [[$FONPATH]] not exist! Exit now. ***"
exit
else
echo "√√√ FONPATH = $FONPATH"
echo "√√√ FONPATH = [[$FONPATH]]"
fi
cd $FONPATH
echo "*** Starting from [`pwd`] ***"
echo "*** Starting from [[`pwd`]] ***"
echo ""
echo "=== Enter [path-to-seafile-ignore.txt]"
@ -31,7 +31,7 @@ read -p ">>> " SFIGNOREPATH
echo ""
if [ ! -f "$SFIGNOREPATH/seafile-ignore.txt" ]
then
echo "××× Not existed [$SFIGNOREPATH/seafile-ignore.txt]. Exit now..."
echo "××× Not found [[$SFIGNOREPATH/seafile-ignore.txt]]. Exit now..."
exit
fi
@ -39,7 +39,7 @@ find . -mindepth 1 -maxdepth 3 -type d -name '[^.]*' | grep -E -v 'node_modules
do
if [ -d "$repo/.git" ]
then
echo "---- updating seafile-ignore.txt in [$repo] ----"
echo "---- updating seafile-ignore.txt in [[$repo]] ----"
cp $SFIGNOREPATH/seafile-ignore.txt $repo/
echo ""
fi