diff --git a/acme-setup.sh b/acme-setup.sh index 4597870..5f56bfd 100644 --- a/acme-setup.sh +++ b/acme-setup.sh @@ -1,21 +1,21 @@ while [ ! "$TARGET_HOSTNAME" ] do - echo "#<<< DNS name such as www.example.com: " - read -p "#>>> " TARGET_HOSTNAME + echo "::*** DNS name such as www.example.com: " + read -p "***:: " TARGET_HOSTNAME done echo "*** -d $TARGET_HOSTNAME" echo while [ ! "$ISSUEMODE" ] do - echo "#<<< Issue mode:" + 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" - read -p "#>>> " ISSUEMODE + read -p "***:: " ISSUEMODE if [ "$ISSUEMODE" == 's' ] then ISSUEPARM="--standalone" @@ -45,8 +45,8 @@ if [ "$ISSUEMODE" == 'd' ] then while [ ! "$DNSAPI" ] do - echo "#<<< DNS API provider, [cf] for CloudFlare, [dp] for DNSPod/腾讯云, [ali] for Aliyun/阿里云:" - read -p "#>>> " DNSAPI_PROVIDER + echo "::*** DNS API provider, [cf] for CloudFlare, [dp] for DNSPod/腾讯云, [ali] for Aliyun/阿里云:" + read -p "***:: " DNSAPI_PROVIDER if [ "$DNSAPI_PROVIDER" == 'cf' ] then DNSAPI='dns_cf' @@ -70,25 +70,25 @@ echo "***" ~/.acme.sh/acme.sh --issue -d $TARGET_HOSTNAME $ISSUEPARM $DNSAPI echo -echo "#<<< Install certificates? [n] for no, [anything else] to install: " -read -p "#>>> " INSTALL_CERT +echo "::*** Install certificates? [n] for no, [anything else] to install: " +read -p "***:: " INSTALL_CERT if [ "$INSTALL_CERT" != 'n' ] then echo while [ ! "$KEY_FILE_PATH" ] do - echo "#<<< Deploy key file to: " - read -p "#>>> " KEY_FILE_PATH + echo "::*** Deploy key file to: " + read -p "***:: " KEY_FILE_PATH done echo while [ ! "$FULLCHAIN_FILE_PATH" ] do - echo "#<<< Deploy fullchain file to: " - read -p "#>>> " FULLCHAIN_FILE_PATH + echo "::*** Deploy fullchain file to: " + read -p "***:: " FULLCHAIN_FILE_PATH done echo - echo "#<<< Set reload command, [leave blank] for default to 'service nginx force-reload'" - read -p "#>>> " RELOADCMD + echo "::*** Set reload command, [leave blank] for default to 'service nginx force-reload'" + read -p "***:: " RELOADCMD if [ ! "$RELOADCMD" ] then RELOADCMD="service nginx force-reload" diff --git a/cpu-test-by-pi.sh b/cpu-test-by-pi.sh index b4b2bac..b2e1ba2 100755 --- a/cpu-test-by-pi.sh +++ b/cpu-test-by-pi.sh @@ -1,7 +1,7 @@ #!/bin/bash -echo "#<<< Enter Pi precision to calculate (leave blank for default to 5000): " -read -p "#>>> " precision +echo "::*** Enter Pi precision to calculate (leave blank for default to 5000): " +read -p "***:: " precision if [ ! $precision ]; then precision=5000 fi diff --git a/debian-add-user.sh b/debian-add-user.sh index 333de7b..6a99b3c 100755 --- a/debian-add-user.sh +++ b/debian-add-user.sh @@ -5,8 +5,8 @@ echo NewUser=$1 while [ ! "$NewUser" ] do - echo "#<<< To add a new user of name:" - read -p "#>>> " NewUser + echo "::*** To add a new user of name:" + read -p "***:: " NewUser done useradd $NewUser @@ -22,8 +22,8 @@ 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" -read -p "#>>> " AllowSudo +echo "::*** Allow the new user [[$NewUser]] to sudo without password? [y] for yes, [anything else] for no" +read -p "***:: " AllowSudo if [ "$AllowSudo" = "y" ] then #usermod -a -G sudo $NewUser # Add to sudo group # Option 1: add user to %sudo group diff --git a/debian-ddinstall-debi.sh b/debian-ddinstall-debi.sh index 2172c2c..d18c081 100755 --- a/debian-ddinstall-debi.sh +++ b/debian-ddinstall-debi.sh @@ -3,8 +3,8 @@ echo "Thanks https://github.com/bohanyang/debi" echo -echo "#<<< Enter debian version [8,9,10,11] or [leave blank] for 11" -read -p "#>>> " DEBIAN_VERSION +echo "::*** Enter debian version [8,9,10,11] or [leave blank] for 11" +read -p "***:: " DEBIAN_VERSION if [ -z "${DEBIAN_VERSION}" ] then DEBIAN_VERSION=11 @@ -23,8 +23,8 @@ ARCH=`dpkg --print-architecture` # ARCH=amd64 # fi -echo "#<<< Enter presets to download from [cdn, aws, china] or [leave blank] for cdn" -read -p "#>>> " PRESET +echo "::*** Enter presets to download from [cdn, aws, china] or [leave blank] for cdn" +read -p "***:: " PRESET if [ -z "${PRESET}" ] then PRESET=cdn @@ -35,11 +35,11 @@ sudo chmod a+rx debi.sh sudo ./debi.sh --version $DEBIAN_VERSION --architecture `dpkg --print-architecture` --user root --$PRESET # --architecture 可参略或者[amd64(默认), i386, arm64, armhf];--password 可省略,则脚本启动后会问你要密码 echo -echo "#<<< Last chance!!! Enter [r] to reboot to new system, or [anything else] to cancel all changes" -read -p "#>>> " LAST +echo "::*** Last chance!!! Enter [r] to reboot to new system, or [anything else] to cancel all changes" +read -p "***:: " LAST if [ 'r' = "$LAST" ] then - echo "#<<< Shutdown now, wait for about 30 minutes (the project's github says 30 seconds), then try to ssh" + echo "::*** Shutdown now, wait for about 30 minutes (the project's github says 30 seconds), then try to ssh" sudo shutdown -r now else sudo rm -rf debi.sh /etc/default/grub.d/zz-debi.cfg /boot/debian-* && { sudo update-grub || sudo grub2-mkconfig -o /boot/grub2/grub.cfg; } diff --git a/debian-setup.sh b/debian-setup.sh index 105332e..72f6148 100755 --- a/debian-setup.sh +++ b/debian-setup.sh @@ -11,17 +11,17 @@ else NewUser=adot fi -echo "#<<< Installing basic tools" +echo "::*** Installing basic tools" apt update apt install -y emacs git wget curl screen sudo automake rsync net-tools dnsutils gcc g++ make python3 jq # Debian 12.0 has no python package, However the following packages replace it: python-is-python3 2to3 echo -echo "#<<< Making dir /faronear/" +echo "::*** Making dir /faronear/" mkdir -p /faronear/ echo -echo "#<<< Git cloning to /faronear/sysconfig" +echo "::*** Git cloning to /faronear/sysconfig" git config --global credential.helper cache if [ ! -d "/faronear/sysconfig" ] then @@ -30,19 +30,19 @@ then fi echo -echo "#<<< Configure root home" +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:" -read -p "#>>> " ChangeRootPassword +echo "::*** Change root password? [y] for yes, [anything else] for omit:" +read -p "***:: " ChangeRootPassword if [ "$ChangeRootPassword" == 'y' ] then passwd fi echo -echo "#<<< Configure /etc/sudoers to includedir /etc/sudoers.d" +echo "::*** Configure /etc/sudoers to includedir /etc/sudoers.d" #sed -i "s|%sudo\s\+ALL=(ALL:ALL)\sALL|%sudo\tALL=(ALL:ALL) NOPASSWD:ALL|g" /etc/sudoers # allow all users in %sudo group to sudo without password DebianVersionMain=`cat /etc/debian_version | sed -r 's/^([0-9]+)\..*$/\1/'` if [ "$DebianVersionMain" == '10' ] @@ -58,16 +58,16 @@ echo if [ -e /etc/ssh/sshd_config ] then - echo "#<<< Deny root login: PermitRootLogin no" + echo "::*** Deny root login: PermitRootLogin no" sed -i "s|PermitRootLogin |#PermitRootLogin |g" /etc/ssh/sshd_config && echo 'PermitRootLogin no' >> /etc/ssh/sshd_config - echo "#<<< Allow password login: PasswordAuthentication yes" + echo "::*** Allow password login: PasswordAuthentication yes" sed -i "s|PasswordAuthentication |#PasswordAuthentication |g" /etc/ssh/sshd_config && echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config service sshd restart echo fi -echo "#<<< Set [new hostname] or [leave blank] for no change" -read -p "#>>> " NewHostname +echo "::*** Set [new hostname] or [leave blank] for no change" +read -p "***:: " NewHostname if [ $NewHostname ] then sed -i "s|\b`hostname`\b|$NewHostname|g" /etc/hosts # echo "127.0.0.1 $NewHostname" >> /etc/hosts @@ -77,7 +77,7 @@ else fi echo -echo "#<<< Configure autostart" +echo "::*** Configure autostart" if [ -f /etc/rc.local ] then # 在腾讯云的 Debian 11.1 里,/etc/rc.local 第一行是 "#!bin/bash",应当是错误的。 @@ -93,24 +93,24 @@ 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:" -read -p "#>>> " ConfigLocales +echo "::*** Configure locales: [y] for yes, [anything else] for no change:" +read -p "***:: " ConfigLocales if [ "$ConfigLocales" == 'y' ] then dpkg-reconfigure locales fi echo -echo "#<<< Add a new user [[$NewUser]]? [y] for yes, [anything else] for no change:" -read -p "#>>> " AddNewUser +echo "::*** Add a new user [[$NewUser]]? [y] for yes, [anything else] for no change:" +read -p "***:: " AddNewUser if [ "$AddNewUser" == 'y' ] then source /faronear/sysconfig/debian-add-user.sh $NewUser 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:" - read -p "#>>> " XfceAutologin + 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 @@ -122,4 +122,4 @@ then fi echo -echo "#<<< Debian System Setup Completed." +echo "::*** Debian System Setup Completed." diff --git a/debian-version.sh b/debian-version.sh index de6baad..c1cc8e6 100755 --- a/debian-version.sh +++ b/debian-version.sh @@ -1,30 +1,30 @@ #!/bin/bash -echo "#>>> cat /etc/issue" +echo "::*** cat /etc/issue" cat /etc/issue echo -echo "#>>> cat /etc/debian_version" +echo "::*** cat /etc/debian_version" cat /etc/debian_version echo -echo "#>>> cat /etc/os-release" +echo "::*** cat /etc/os-release" cat /etc/os-release echo -echo "#>>> cat /etc/cpuinfo" +echo "::*** cat /etc/cpuinfo" cat /etc/cpuinfo echo -# echo "#>>> lsb-release" +# echo "::*** lsb-release" # apt install lsb-release # lsb-release -a # echo -echo "#>>> hostnamectl" +echo "::*** hostnamectl" hostnamectl echo -echo "#>>> uname -a" +echo "::*** uname -a" uname -a echo \ No newline at end of file diff --git a/docker-allow-user.sh b/docker-allow-user.sh index 0c876a6..655fc14 100755 --- a/docker-allow-user.sh +++ b/docker-allow-user.sh @@ -1,10 +1,10 @@ -echo "#<<< Add a non-root user to run docker" +echo "::*** Add a non-root user to run docker" if [ "$1" ] then DOCKERUSER=$1 else echo "Enter the [user name] or [leave blank] for default to '`whoami`'" - read -p "#>>> " DOCKERUSER + read -p "***:: " DOCKERUSER if [ ! "$DOCKERUSER" ] then DOCKERUSER=`whoami` diff --git a/docker-install-debian.sh b/docker-install-debian.sh index 334c9f3..4e4e70b 100644 --- a/docker-install-debian.sh +++ b/docker-install-debian.sh @@ -6,9 +6,9 @@ # 安装自带版本 apt install docker.io && apt install docker-compose # sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin -echo "#<<< Option 1: Install docker with latest official repositories, Option 2: Install docker with default (maybe outdated) linux repositories (sudo apt install docker.io && sudo apt install docker-compose && sudo snap install docker)" -echo "#<<< Choose docker source: [a] 阿里云, [z] 中科大, [leave blank] for default" -read -p "#>>> " DOCKER_SOURCE +echo "::*** Option 1: Install docker with latest official repositories, Option 2: Install docker with default (maybe outdated) linux repositories (sudo apt install docker.io && sudo apt install docker-compose && sudo snap install docker)" +echo "::*** Choose docker source: [a] 阿里云, [z] 中科大, [leave blank] for default" +read -p "***:: " DOCKER_SOURCE if [ "$DOCKER_SOURCE" = 'a' ] then GPG_URL=http://mirrors.aliyun.com/docker-ce/linux/debian/gpg @@ -49,8 +49,8 @@ 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:" -read -p "#>>> " DOCKER_MIRROR +echo "::*** Enter [y] to 配置中国加速镜像源 /etc/docker/daemon.json, [anything else] for no mirror:" +read -p "***:: " DOCKER_MIRROR if [ "$DOCKER_MIRROR" = 'y' ] then echo '{ "registry-mirrors": [' > /etc/docker/daemon.json @@ -62,8 +62,8 @@ then echo '] }' >> /etc/docker/daemon.json fi -echo "#<<< 启动docker服务?[y] for yes, [anything else] for no" -read -p "#>>> " StartDockerDaemon +echo "::*** 启动docker服务?[y] for yes, [anything else] for no" +read -p "***:: " StartDockerDaemon if [ "$StartDockerDaemon" = 'y' ] then sudo systemctl enable docker # 开机启动 diff --git a/docker-search-tags.sh b/docker-search-tags.sh index 9c5884a..f66dae4 100755 --- a/docker-search-tags.sh +++ b/docker-search-tags.sh @@ -9,8 +9,8 @@ echo IMAGE=$1 while [ ! "$IMAGE" ] do - echo "#<<< Enter [image name]:" - read -p "#>>> " IMAGE + echo "::*** Enter [image name]:" + read -p "***:: " IMAGE echo done @@ -21,8 +21,8 @@ then then OWNER="library" else - echo "#<<< Enter [owner name] or [empty] for default 'library':" - read -p "#>>> " OWNER + echo "::*** Enter [owner name] or [empty] for default 'library':" + read -p "***:: " OWNER if [ ! "$OWNER" ] then OWNER="library" @@ -31,7 +31,7 @@ then fi echo -echo "#<<< Searching $OWNER/$IMAGE ......" +echo "::*** Searching $OWNER/$IMAGE ......" echo page_size=100 diff --git a/expect-ssh2server.sh b/expect-ssh2server.sh index 31798f8..3f9d651 100755 --- a/expect-ssh2server.sh +++ b/expect-ssh2server.sh @@ -23,8 +23,8 @@ else echo " sh : $sh" echo " wx : $wx" echo - echo "#<<< Enter target (leave blank to specify host/user/pwd):" - read -p "#>>> " TARGET + echo "::*** Enter target (leave blank to specify host/user/pwd):" + read -p "***:: " TARGET if [ ! $TARGET ] then TARGET=other diff --git a/find-and-run-recursively.sh b/find-and-run-recursively.sh index 9b9e0c4..99f18f2 100644 --- a/find-and-run-recursively.sh +++ b/find-and-run-recursively.sh @@ -3,39 +3,39 @@ echo "find \$FOLDER -mindepth \$MINDEPTH -maxdepth \$MAXDEPTH -type d_f_l -name echo "***************************************" echo "To find in which path? Enter [root path] or [leave blank] for the current path [[`pwd`]]:" -read -p "path #>>> " FIND_FOLDER +read -p "path ***:: " FIND_FOLDER if [ ! "$FIND_FOLDER" ] then FIND_FOLDER=`pwd` fi -read -p "mindepth #>>> " MINDEPTH +read -p "mindepth ***:: " MINDEPTH if [ "$MINDEPTH" ] then MINDEPTH_CLAUSE="-mindepth $MINDEPTH" fi -read -p "maxdepth #>>> " MAXDEPTH +read -p "maxdepth ***:: " MAXDEPTH if [ "$MAXDEPTH" ] then MAXDEPTH_CLAUSE="-maxdepth $MAXDEPTH" fi echo "To find file or directory? [f] for file, [d] for directory, [l] for link, [anything else] for all:" -read -p "type #>>> " FIND_TYPE +read -p "type ***:: " FIND_TYPE if [ "$FIND_TYPE" = 'f' ] || [ "$FIND_TYPE" = 'd' ] || [ "$FIND_TYPE" = 'l' ] then FIND_TYPE_CLAUSE="-type $FIND_TYPE" fi echo "To match pattern: [regex pattern] (e.g. '._*', '.*.js') or or [leave blank] for all:" -read -p "#>>> " FIND_PATTERN +read -p "***:: " FIND_PATTERN if [ ! "$FIND_PATTERN" ] then FIND_PATTERN="*" fi echo "To do something on each: [command line] or [leave blank] for 'echo':" -read -p "pattern #>>> " FIND_ACTION +read -p "pattern ***:: " FIND_ACTION if [ ! "$FIND_ACTION" ] then FIND_ACTION='echo' diff --git a/geth-install.sh b/geth-install.sh index 3a2b07d..0ca2cd1 100755 --- a/geth-install.sh +++ b/geth-install.sh @@ -4,8 +4,8 @@ if [ $1 ] then VERSION=$1 else - echo "#<<< Install geth version of \n [version number] for example 1.10.26 \n [leave blank] for the latest version" - read -p "#>>> " VERSION + echo "::*** Install geth version of \n [version number] for example 1.10.26 \n [leave blank] for the latest version" + read -p "***:: " VERSION fi if [ "$(uname)" = "Linux" ] @@ -27,8 +27,8 @@ fi OS=`uname | tr 'A-Z' 'a-z'` -echo "#<<< Install geth:[b] for 二进制, [s] for 源代码,[anything else or leave blank] for no change" -read -p "#>>> " BINARY_OR_SOURCE +echo "::*** Install geth:[b] for 二进制, [s] for 源代码,[anything else or leave blank] for no change" +read -p "***:: " BINARY_OR_SOURCE if [ "$BINARY_OR_SOURCE" == 'b' ] then echo "--- Extracting download link with correct hash from https://geth.ethereum.org/downloads" diff --git a/geth-prepare.sh b/geth-prepare.sh index 758191e..3dfffc8 100755 --- a/geth-prepare.sh +++ b/geth-prepare.sh @@ -1,7 +1,7 @@ #!/bin/bash -echo "#<<< Set [datadir] name, leave [blank] for default 'pex-data-poa'(可以尚未存在):" -read -p "#>>> " DATADIR +echo "::*** Set [datadir] name, leave [blank] for default 'pex-data-poa'(可以尚未存在):" +read -p "***:: " DATADIR if [ ! "$DATADIR" ] then DATADIR=chain-poa @@ -9,8 +9,8 @@ fi echo "*** DATADIR = $DATADIR " echo "" -echo "#<<< Init accounts: [y] for yes, [anything else] for no change" -read -p "#>>> " INIT_ACCOUNTS +echo "::*** Init accounts: [y] for yes, [anything else] for no change" +read -p "***:: " INIT_ACCOUNTS if [ $INIT_ACCOUNTS ] && [ $INIT_ACCOUNTS == 'y' ] then echo "--- 生成新账户,自动存放在 ./$DATADIR/keystore/" @@ -24,8 +24,8 @@ else fi echo "" -echo "#<<< Init chain from genesis-$DATADIR.json: [y] for yes, [anything else] for no change" -read -p "#>>> " INIT_CHAIN +echo "::*** Init chain from genesis-$DATADIR.json: [y] for yes, [anything else] for no change" +read -p "***:: " INIT_CHAIN if [ $INIT_CHAIN ] && [ $INIT_CHAIN == 'y' ] then echo "--- 初始化链上数据,存放在 ./$DATADIR/geth/" diff --git a/geth-run.sh b/geth-run.sh index a0df107..6162926 100755 --- a/geth-run.sh +++ b/geth-run.sh @@ -4,8 +4,8 @@ DATADIR=$1 while [ ! "$DATADIR" ] || [ ! -d "./$DATADIR" ] do - echo "#<<< Set [datadir] name, leave [blank] for default 'pex-data-poa'" - read -p "#>>> " DATADIR + echo "::*** Set [datadir] name, leave [blank] for default 'pex-data-poa'" + read -p "***:: " DATADIR if [ ! "$DATADIR" ] then DATADIR=chain-poa @@ -15,15 +15,15 @@ echo "" echo "Run geth in pm2? [y] for yes, [anything else] for raw geth:" -read -p "#>>> " RUNPM2 +read -p "***:: " RUNPM2 echo "--- Creating ./$DATADIR/geth.ipc ..." # http.addr 默认为 127.0.0.1 => 无法从远处连接。要用 0.0.0.0 才能从远处用 IP 连接。 # shh 是 whisper 协议,好像要先启动 websocket 接口才能启用。 while [ ! "$KEYCODE" ] do - echo "#<<< Define chain keycode, for instance '882' for tuc chain:" - read -p "#>>> " KEYCODE + echo "::*** Define chain keycode, for instance '882' for tuc chain:" + read -p "***:: " KEYCODE done if [ "$RUNPM2" == 'y' ] diff --git a/git-config.sh b/git-config.sh index e605b33..1eb2bb8 100755 --- a/git-config.sh +++ b/git-config.sh @@ -2,7 +2,7 @@ echo "---------------------------------------------" echo "User Name (leave blank for no change)" -read -p "#>>> " UserName +read -p "***:: " UserName if [ $UserName ] then echo "git config --global user.name $UserName" @@ -11,7 +11,7 @@ fi echo "---------------------------------------------" echo "User Email (leave blank for no change)" -read -p "#>>> " UserEmail +read -p "***:: " UserEmail if [ $UserEmail ] then echo "git config --global user.email $UserEmail" @@ -21,7 +21,7 @@ fi echo "---------------------------------------------" echo "如果 git 远程服务器的 ssl 证书过期,或者使用了自颁发的证书,连接时会出现验证错误 Cannot verify local issuer" echo "Verify ssl? (true or false, blank for no change)" -read -p "#>>> " HttpSslVerify +read -p "***:: " HttpSslVerify if [ $HttpSslVerify ] then echo "git config --global http.sslVerify $HttpSslVerify" @@ -30,7 +30,7 @@ fi echo "---------------------------------------------" echo "Store credential in cache or store? (leave blank for no change)" -read -p "#>>> " CredentialHelper +read -p "***:: " CredentialHelper if [ $CredentialHelper ] then echo "git config --global credential.helper $CredentialHelper" @@ -39,7 +39,7 @@ fi echo "---------------------------------------------" echo "Store pull rebase to true or false? (leave blank for no change)" -read -p "#>>> " PullRebase +read -p "***:: " PullRebase if [ $PullRebase ] then echo "git config --global pull.rebase $PullRebase" @@ -48,7 +48,7 @@ fi echo "---------------------------------------------" echo "Path to global gitignore file? (For example ~/.gitignore.global.txt, leave blank for no change)" -read -p "#>>> " ExcludesFile +read -p "***:: " ExcludesFile if [ $ExcludesFile ] then echo "git config --global core.excludesfile $ExcludesFile" @@ -59,7 +59,7 @@ fi echo "---------------------------------------------" echo "Set default branch since git 2.28 to master or main? (leave blank for no change)" -read -p "#>>> " DefaultBranch +read -p "***:: " DefaultBranch if [ $DefaultBranch ] then echo "git config --global init.defaultbranch $DefaultBranch" diff --git a/git-ignore-find2merge.bat b/git-ignore-find2merge.bat index 090b30c..3c90e63 100644 --- a/git-ignore-find2merge.bat +++ b/git-ignore-find2merge.bat @@ -7,7 +7,7 @@ set ROOTPATH= set ROOTPATH=%1 ) else ( echo; - echo #<<< Enter [root path] or [leave blank] for default [[%CD%]] to start tree search for .gitignore files + echo ::*** Enter [root path] or [leave blank] for default [[%CD%]] to start tree search for .gitignore files set /p ROOTPATH=">>> " echo; if "" == "%ROOTPATH%" ( @@ -23,7 +23,7 @@ if not exist "%ROOTPATH%" ( echo √√√ ROOTPATH = [[%ROOTPATH%]] ) -echo #<<< Enter [path to .gitignore.global.txt] or [leave blank] for default [[https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/.gitignore.global.txt]] +echo ::*** Enter [path to .gitignore.global.txt] or [leave blank] for default [[https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/.gitignore.global.txt]] set /p IGNOREPATH=">>> " echo; if "" == "%IGNOREPATH%" ( @@ -39,7 +39,7 @@ if "" == "%IGNOREPATH%" ( ) pushd %ROOTPATH% -echo #<<< Starting from [[%CD%]] +echo ::*** Starting from [[%CD%]] echo; for /d /r %%r in (*) do ( diff --git a/git-ignore-find2merge.sh b/git-ignore-find2merge.sh index 9ec70f6..bb847b1 100644 --- a/git-ignore-find2merge.sh +++ b/git-ignore-find2merge.sh @@ -8,8 +8,8 @@ if [ -d "$1" ] then ROOTPATH=$1 else - echo "#<<< Enter [root path] or [leave blank] for default [[`pwd`]] to start tree search for git repositories" - read -p "#>>> " ROOTPATH + echo "::*** Enter [root path] or [leave blank] for default [[`pwd`]] to start tree search for git repositories" + read -p "***:: " ROOTPATH if [ "$ROOTPATH" ] then ROOTPATH=$(realpath $ROOTPATH) @@ -26,8 +26,8 @@ else fi echo "" -echo "#<<< Enter [path to .gitignore.global.txt] or [leave blank] for default [[https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/.gitignore.global.txt]]" -read -p "#>>> " IGNOREPATH +echo "::*** Enter [path to .gitignore.global.txt] or [leave blank] for default [[https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/.gitignore.global.txt]]" +read -p "***:: " IGNOREPATH if [ "$IGNOREPATH" ] then if [ -d "$IGNOREPATH" ] @@ -46,8 +46,8 @@ else fi echo "" -echo "#<<< Enter [y] to start updating, or [anything else] to quit" -read -p "#>>> " YESNO +echo "::*** Enter [y] to start updating, or [anything else] to quit" +read -p "***:: " YESNO if [ "$YESNO" != 'y' ] then exit diff --git a/git-ignore-merge-here.sh b/git-ignore-merge-here.sh index 38acf64..23d5d20 100644 --- a/git-ignore-merge-here.sh +++ b/git-ignore-merge-here.sh @@ -1,6 +1,6 @@ #!/bin/bash -echo #<<< Merge remote [.gitignore.global.txt] and local [.gitignore.local.txt] to [.gitignore] +echo ::*** Merge remote [.gitignore.global.txt] and local [.gitignore.local.txt] to [.gitignore] curl -sSL https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/.gitignore.global.txt > .gitignore if [ -f .gitignore.local.txt ]; then cat .gitignore.local.txt >> .gitignore; fi; echo diff --git a/git-pull-tree.bat b/git-pull-tree.bat index e045d96..9ec37c3 100644 --- a/git-pull-tree.bat +++ b/git-pull-tree.bat @@ -7,7 +7,7 @@ set ROOTPATH= set ROOTPATH=%1 ) else ( echo; - echo #<<< Enter [root path]> or [leave blank] for default to [[%CD%]] + echo ::*** Enter [root path]> or [leave blank] for default to [[%CD%]] set /p ROOTPATH=">>> " echo; if "" == "%ROOTPATH%" ( @@ -23,20 +23,20 @@ if not exist "%ROOTPATH%" ( ) pushd %ROOTPATH% -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 [[%ROOTPATH%\%%o]] + echo ::******** entering [[%ROOTPATH%\%%o]] echo; pushd %%o for /d %%g in (*) do ( if exist "%%g\.git" ( pushd %%g - echo #<<<== git pulling [[%ROOTPATH%\%%o\%%g]] + echo ::***** git pulling [[%ROOTPATH%\%%o\%%g]] git pull --all echo; popd @@ -51,7 +51,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 diff --git a/git-pull-tree.sh b/git-pull-tree.sh index 1d930ed..10e5364 100755 --- a/git-pull-tree.sh +++ b/git-pull-tree.sh @@ -5,8 +5,8 @@ then ROOTPATH=$1 else echo "" - echo "#<<< Enter [root path] or [leave blank] for default to [[`pwd`]]" - read -p "#>>> " ROOTPATH + echo "::*** Enter [root path] or [leave blank] for default to [[`pwd`]]" + read -p "***:: " ROOTPATH if [ "$ROOTPATH"] then ROOTPATH=`realpath $ROOTPATH` @@ -23,8 +23,8 @@ else fi echo "" -echo "#<<< Enter [y] to start updating, or [anything else] to quit" -read -p "#>>> " YESNO +echo "::*** Enter [y] to start updating, or [anything else] to quit" +read -p "***:: " YESNO if [ "$YESNO" != 'y' ] then exit @@ -39,7 +39,7 @@ 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 [[$ROOTPATH/$org]]" + echo "::******** entering [[$ROOTPATH/$org]]" echo "" cd "$org"; for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格 diff --git a/git-push-tree.bat b/git-push-tree.bat index 50ec36c..a289573 100644 --- a/git-push-tree.bat +++ b/git-push-tree.bat @@ -7,7 +7,7 @@ set ROOTPATH= set ROOTPATH=%1 ) else ( echo; - echo #<<< Enter [root path] or [leave blank] for default to [[%CD%]] + echo ::*** Enter [root path] or [leave blank] for default to [[%CD%]] set /p ROOTPATH=">>> " echo; if "" == "%ROOTPATH%" ( @@ -23,10 +23,10 @@ if not exist "%ROOTPATH%" ( ) pushd %ROOTPATH% -echo #<<< Starting from [[%CD%]] +echo ::*** Starting from [[%CD%]] echo; -echo #<<< Enter [commit message] or [leave blank] for default to 'updated' +echo ::*** Enter [commit message] or [leave blank] for default to 'updated' set /p COMMIT_MESSAGE=">>> " @ if "" == "%COMMIT_MESSAGE%" ( set COMMIT_MESSAGE="updated" @@ -37,7 +37,7 @@ 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 [[%ROOTPATH%\%%o]] + echo ::***** entering [[%ROOTPATH%\%%o]] echo; pushd "%%o" for /d %%g in (*) do ( @@ -58,7 +58,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 diff --git a/git-push-tree.sh b/git-push-tree.sh index fb72211..6cb061c 100755 --- a/git-push-tree.sh +++ b/git-push-tree.sh @@ -5,8 +5,8 @@ then ROOTPATH=$1 else echo "" - echo "#<<< Enter [root path] or [leave blank] for default to [[`pwd`]]" - read -p "#>>> " ROOTPATH + echo "::*** Enter [root path] or [leave blank] for default to [[`pwd`]]" + read -p "***:: " ROOTPATH if [ "$ROOTPATH"] then ROOTPATH=`realpath $ROOTPATH` @@ -22,8 +22,8 @@ else echo "√√√ ROOTPATH = [[$ROOTPATH]]" fi -echo "#<<< Enter [y] to start updating, or [anything else] to quit" -read -p "#>>> " YESNO +echo "::*** Enter [y] to start updating, or [anything else] to quit" +read -p "***:: " YESNO if [ "$YESNO" != 'y' ] then exit @@ -33,23 +33,23 @@ pushd $ROOTPATH echo "*** Starting from [[`pwd`]] ***" echo "" -echo "#<<< Enter [commit message] or [leave blank] for default to 'updated'" -read -p "#>>> " COMMIT_MESSAGE +echo "::*** Enter [commit message] or [leave blank] for default to 'updated'" +read -p "***:: " COMMIT_MESSAGE if [ ! "$COMMIT_MESSAGE" ] then COMMIT_MESSAGE="Update" fi echo "" -echo "#<<< Enter [h] for hierarchical, [r] for recursive, [anything else] for listing" -read -p "#>>> " ACTION_TYPE +echo "::*** Enter [h] for hierarchical, [r] for recursive, [anything else] for listing" +read -p "***:: " ACTION_TYPE if [ "$ACTION_TYPE" == 'h' ] 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 [[$ROOTPATH/$org]]" + echo "::******** entering [[$ROOTPATH/$org]]" echo "" cd "$org"; for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格 diff --git a/git-rename-branch.bat b/git-rename-branch.bat index 6c30b95..6a8a388 100755 --- a/git-rename-branch.bat +++ b/git-rename-branch.bat @@ -7,7 +7,7 @@ set ROOTPATH= set ROOTPATH=%1 ) else ( echo; - echo #<<< Enter [root path]> or [leave blank] for default to [[%CD%]] + echo ::*** Enter [root path]> or [leave blank] for default to [[%CD%]] set /p ROOTPATH=">>> " echo; if "" == "%ROOTPATH%" ( @@ -23,7 +23,7 @@ if not exist %ROOTPATH% ( ) pushd %ROOTPATH% -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 ) diff --git a/git-rename-branch.sh b/git-rename-branch.sh index 057227e..f1fdff1 100755 --- a/git-rename-branch.sh +++ b/git-rename-branch.sh @@ -5,8 +5,8 @@ then ROOTPATH=$1 else echo "" - echo "#<<< Enter [root path] or [leave blank] for default to [[`pwd`]]" - read -p "#>>> " ROOTPATH + echo "::*** Enter [root path] or [leave blank] for default to [[`pwd`]]" + read -p "***:: " ROOTPATH if [ "$ROOTPATH"] then ROOTPATH=`realpath $ROOTPATH` @@ -22,8 +22,8 @@ else echo "√√√ ROOTPATH = [[$ROOTPATH]]" fi -echo "#<<< Enter [y] to start updating, or [anything else] to quit" -read -p "#>>> " YESNO +echo "::*** Enter [y] to start updating, or [anything else] to quit" +read -p "***:: " YESNO if [ "$YESNO" != 'y' ] then exit @@ -36,7 +36,7 @@ echo "" # for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。 ls -F | grep '/$' | grep -v '=' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名 do - echo "#<<<===== entering [[$ROOTPATH/$org]]" + echo "::******** entering [[$ROOTPATH/$org]]" echo "" cd "$org"; for repo in * ## for ??? in * 是分割成一个个目录名的,即使目录名含有空格 diff --git a/git-repo-change-hook-path.sh b/git-repo-change-hook-path.sh index 2e1b16e..05c0fb7 100755 --- a/git-repo-change-hook-path.sh +++ b/git-repo-change-hook-path.sh @@ -3,22 +3,22 @@ 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 string] or [leave blank] for default '/faronear/git/gitea/gitea':" -read -p "#>>> " OLDPATH +echo "::*** Enter [old hook path string] 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 string] or [leave blank] for default '/usr/local/bin/gitea': " -read -p "#>>> " NEWPATH +echo "::*** Enter [new hook path string] or [leave blank] for default '/usr/local/bin/gitea': " +read -p "***:: " NEWPATH if [ ! "$NEWPATH" ] then NEWPATH=/usr/local/bin/gitea fi -echo "#<<< Enter [root path] of repositories, or [leave blank] for default [[]]`pwd`]] " -read -p "#>>> " REPOROOT +echo "::*** Enter [root path] of repositories, or [leave blank] for default [[]]`pwd`]] " +read -p "***:: " REPOROOT if [ "$ROOTPATH"] then ROOTPATH=`realpath $ROOTPATH` @@ -26,8 +26,8 @@ else ROOTPATH=`pwd` fi -echo "#<<< Enter [y] to start updating, or [anything else] to quit" -read -p "#>>> " YESNO +echo "::*** Enter [y] to start updating, or [anything else] to quit" +read -p "***:: " YESNO if [ "$YESNO" != 'y' ] then exit diff --git a/gitea-run.sh b/gitea-run.sh index 3d3cb1d..750f5f0 100755 --- a/gitea-run.sh +++ b/gitea-run.sh @@ -1,5 +1,5 @@ -echo '#>>>> Starting gitea ...' +echo '::*** Starting gitea ...' cd /faronear/git/gitea pm2 start -x './gitea' --name gitea -- web -echo '#>>>> Started gitea.' +echo '::*** Started gitea.' diff --git a/gogs-run.sh b/gogs-run.sh index de1e7dd..8a675df 100755 --- a/gogs-run.sh +++ b/gogs-run.sh @@ -1,13 +1,13 @@ # 服务化方案1: screen -#echo '#>>> Starting gogs in screen ...' +#echo '::*** Starting gogs in screen ...' #screen -dmS gogs #screen -S gogs -X stuff "/faronear/gogs/gogs web\n" # 服务化方案2: pm2 -echo '#>>>> Starting gogs in pm2 ...' +echo '::*** Starting gogs in pm2 ...' cd /faronear/git/gogs # 如果在 /faronear/git 中运行 ./gogs/gogs,导致额外生成 /faronear/git/data 目录。 # sudo it so that pm2 list shows it as root sudo pm2 start -x './gogs' --name git.gogs -- web cd /faronear/git -echo '#>>>> Started gogs.' +echo '::*** Started gogs.' diff --git a/ipfs-install.sh b/ipfs-install.sh index 05c880f..9f62e52 100755 --- a/ipfs-install.sh +++ b/ipfs-install.sh @@ -6,8 +6,8 @@ if [ $1 ] then VERSION=$1 else - echo "#<<< Enter kubo [version number] or [leave blank] for default $defaultVERSION" - read -p "#>>> " VERSION + echo "::*** Enter kubo [version number] or [leave blank] for default $defaultVERSION" + read -p "***:: " VERSION if [ ! $VERSION ] then VERSION=$defaultVERSION diff --git a/mac-brew-apps.sh b/mac-brew-apps.sh index b355f0f..da768d2 100644 --- a/mac-brew-apps.sh +++ b/mac-brew-apps.sh @@ -1,11 +1,11 @@ -echo "#<<< Install formulaes and casks, enter [y] for Yes, [anything else] for No:" +echo "::*** Install formulaes and casks, enter [y] for Yes, [anything else] for No:" echo formulaeList=(cloudflared jq openssl pandoc rclone readline speedtest-cli hudochenkov/sshpass/sshpass v2ray v2raya/v2raya/v2raya yt-dlp) for APP in "${formulaeList[@]}" do echo "--- brew install $APP" - read -p "#>>> " YN + read -p "***:: " YN if [ "$YN" = 'y' ] then brew install $APP @@ -19,7 +19,7 @@ caskList=(appcleaner avidemux baidunetdisk cloudflare-warp cursor discord douyin for APP in "${caskList[@]}" do echo "--- brew install $APP --cask" - read -p "#>>> " YN + read -p "***:: " YN if [ "$YN" = 'y' ] then brew install $APP diff --git a/mac-brew-mirror.sh b/mac-brew-mirror.sh index 47a0764..cb3cc7c 100644 --- a/mac-brew-mirror.sh +++ b/mac-brew-mirror.sh @@ -1,5 +1,5 @@ -echo #<<< Enter [g] to reset git source to github, [a] to 阿里云, [z] to 中科大, [q] to 清华, [anything else] to quit: -read -p '#>>> ' TARGET +echo ::*** Enter [g] to reset git source to github, [a] to 阿里云, [z] to 中科大, [q] to 清华, [anything else] to quit: +read -p '***:: ' TARGET if [ "$TARGET" = 'g' ] then diff --git a/mac-resize-launchpad.sh b/mac-resize-launchpad.sh index 2d366e1..99b848b 100644 --- a/mac-resize-launchpad.sh +++ b/mac-resize-launchpad.sh @@ -1,13 +1,13 @@ -echo "#<<< Enter [row number] (7 for MBA, 9 for iMac) or [leave blank] for default to 9" -read -p "#>>> " ROWS +echo "::*** Enter [row number] (7 for MBA, 9 for iMac) or [leave blank] for default to 9" +read -p "***:: " ROWS if [ "$ROWS" = "" ] then ROWS=9 fi defaults write com.apple.dock springboard-rows -int $ROWS -echo "#<<< Enter [column number] (10 for MBA, 15 for iMac) or [leave blank] for default to 15" -read -p "#>>> " COLS +echo "::*** Enter [column number] (10 for MBA, 15 for iMac) or [leave blank] for default to 15" +read -p "***:: " COLS if [ "$COLS" = "" ] then COLS=15 diff --git a/nixhome-config.sh b/nixhome-config.sh index 506f74f..237fa79 100755 --- a/nixhome-config.sh +++ b/nixhome-config.sh @@ -1,22 +1,19 @@ #!/bin/bash -if [ -d "$1" ] -then +if [ -d "$1" ]; then NIXHOME=$1 -else if [ -d "`pwd`/nixhome" ] -then - NIXHOME=`pwd`/nixhome +elif [ -d "$(pwd)/nixhome" ]; then + NIXHOME=$(pwd)/nixhome else echo "" - echo "#<<< Enter [root path] or [leave blank] for default to [[`pwd`]]" - read -p "#>>> " NIXHOME - if [ ! "$NIXHOME" ] - then - NIXHOME=`pwd` + echo "::*** Enter [root path] or [leave blank] for default to [[$(pwd)]]" + read -p "***:: " NIXHOME + if [ -z "$NIXHOME" ]; then + NIXHOME=$(pwd) fi fi -if [ ! -e "$NIXHOME/.bashrc" ] -then + +if [ ! -e "$NIXHOME/.bashrc" ]; then echo "××× [[$NIXHOME/.bashrc]] not exist! Exit now. ***" exit else @@ -25,60 +22,48 @@ fi echo "" # $2 应当为用户名 -if [ "$2" == 'root' ] -then +if [ "$2" == 'root' ]; then HomePath=/root TheUser=root -elif [ "$2" ] -then +elif [ "$2" ]; then HomePath=/home/$2 TheUser=$2 else # 可能是 root 或其他 HomePath=~ - TheUser=`whoami` + TheUser=$(whoami) fi -if [ -d "$HomePath" ] -then +if [ -d "$HomePath" ]; then - pushd $HomePath + pushd "$HomePath" homescriptlist=".emacs .emacs.lisp .bashrc .bash_profile .gitignore.global.txt" echo - 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 - for homescript in $homescriptlist - do - if [ -e "$homescript" ] || [ -L "$homescript" ] - then - mv $homescript $homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc) + 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 + for homescript in $homescriptlist; do + if [ -e "$homescript" ] || [ -L "$homescript" ]; then + mv "$homescript" "$homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)" fi echo "--- Linking [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..." - ln -s $NIXHOME/$homescript ./ + ln -s "$NIXHOME/$homescript" ./ done - elif [ "$CopyOrLinkScripts" == 'c' ] - then - for homescript in $homescriptlist - do - if [ -e "$homescript" ] || [ -L "$homescript" ] - then - mv $homescript $homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc) + elif [ "$CopyOrLinkScripts" == 'c' ]; then + for homescript in $homescriptlist; do + if [ -e "$homescript" ] || [ -L "$homescript" ]; then + mv "$homescript" "$homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)" fi echo "--- Copying [[$NIXHOME/$homescript]] to [[$HomePath/$homescript]] ..." - cp -r $NIXHOME/$homescript ./ + cp -r "$NIXHOME/$homescript" ./ done - elif [ "$CopyOrLinkScripts" == 'g' ] - then - for homescript in $homescriptlist - do - if [ -e "$homescript" ] || [ -L "$homescript" ] - then - mv $homescript $homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc) + elif [ "$CopyOrLinkScripts" == 'g' ]; then + for homescript in $homescriptlist; do + if [ -e "$homescript" ] || [ -L "$homescript" ]; then + mv "$homescript" "$homescript.backup-$(date -u +%Y%m%dT%H%M%Sutc)" fi - curl -sSLO https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/$homescript + curl -sSLO "https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/$homescript" done else echo '--- Home scripts not changed.' @@ -86,37 +71,31 @@ then echo - if [ "$(uname)" == "Darwin" ] - then + if [ "$(uname)" == "Darwin" ]; then echo '--- No need to configure ./ssh/authorized_keys on Mac OS X. Exit now.' - elif [ "$TheUser" != 'root' ] # 仅允许 non-root 用户进行远程密钥登录 - then + elif [ "$TheUser" != 'root' ]; then - mkdir -p $HomePath/.ssh - chmod 700 $HomePath/.ssh - if [ "$2" ] - then + mkdir -p "$HomePath/.ssh" + chmod 700 "$HomePath/.ssh" + if [ "$2" ]; then # 由 root 指定新用户而创建的配置文件的 owner 是 root,而不是新用户,导致新用户无法读取该文件而密钥登录失败,因此要重设 owner。 - chown $TheUser:$TheUser $HomePath/.ssh + chown "$TheUser:$TheUser" "$HomePath/.ssh" fi - if [ -f "$HomePath/.ssh/authorized_keys" ] || [ -L "$HomePath/.ssh/authorized_keys" ] - then - mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup-$(date -u +%Y%m%dT%H%M%Sutc) + if [ -f "$HomePath/.ssh/authorized_keys" ] || [ -L "$HomePath/.ssh/authorized_keys" ]; 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:" - read -p "#>>> " CopyOrLinkOrOmitAuthorizedKeys + 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 + if [ "$CopyOrLinkOrOmitAuthorizedKeys" = 'l' ]; then 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 + 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]] ..." - cat $NIXHOME/.ssh/authorized_keys >> $HomePath/.ssh/authorized_keys - chmod 600 $HomePath/.ssh/authorized_keys + cat "$NIXHOME/.ssh/authorized_keys" >> "$HomePath/.ssh/authorized_keys" + chmod 600 "$HomePath/.ssh/authorized_keys" fi echo diff --git a/nodejs-install.sh b/nodejs-install.sh index bc2c662..80029ce 100755 --- a/nodejs-install.sh +++ b/nodejs-install.sh @@ -8,8 +8,8 @@ if [ $1 ] then VERSION=$1 else - echo "#<<< Enter [nodejs version] or [leave blank] for default $defaultVERSION, enter [tools] to install C++ build tools" - read -p "#>>> " VERSION + echo "::*** Enter [nodejs version] or [leave blank] for default $defaultVERSION, enter [tools] to install C++ build tools" + read -p "***:: " VERSION if [ ! $VERSION ] then VERSION=$defaultVERSION diff --git a/npm-boot-tree.bat b/npm-boot-tree.bat index d528a6e..3485187 100644 --- a/npm-boot-tree.bat +++ b/npm-boot-tree.bat @@ -7,7 +7,7 @@ set ROOTPATH= set ROOTPATH=%1 ) else ( echo; - echo #<<< Enter [root path] or [leave blank] for default to [[%CD%]] + echo ::*** Enter [root path] or [leave blank] for default to [[%CD%]] set /p ROOTPATH=">>> " echo; if "" == "%ROOTPATH%" ( @@ -23,21 +23,21 @@ if not exist "%ROOTPATH%" ( ) pushd %ROOTPATH% -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 [[%ROOTPATH%\%%o]] + echo ::******** entering [[%ROOTPATH%\%%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 [[%ROOTPATH%\%%o\%%g]] + echo ::***** npm booting [[%ROOTPATH%\%%o\%%g]] npm run boot echo; popd @@ -54,7 +54,7 @@ echo; if exist "%%r\package.json" ( findstr "\"boot\"" "%%r\package.json" >NUL && ( pushd %%r - echo #<<<== npm booting [[%ROOTPATH%\%%r]] + echo ::***** npm booting [[%ROOTPATH%\%%r]] npm run boot echo; popd diff --git a/npm-boot-tree.sh b/npm-boot-tree.sh index 0fc4a65..ff876b3 100755 --- a/npm-boot-tree.sh +++ b/npm-boot-tree.sh @@ -5,8 +5,8 @@ then ROOTPATH=$1 else echo "" - echo "#<<< Enter [root path] or [leave blank] for default to [[`pwd`]]" - read -p "#>>> " ROOTPATH + echo "::*** Enter [root path] or [leave blank] for default to [[`pwd`]]" + read -p "***:: " ROOTPATH if [ ! "$ROOTPATH" ] then ROOTPATH=`pwd` @@ -30,17 +30,17 @@ then # for org in `ls -F | grep '/$' | grep -v '~'` ## 首先过滤出所有子目录,然后过滤出所有不含 ~ 的子目录。注意 for ??? in `ls ???` 是按照空行以及空格进行分割的,因此最后筛选出的目录名不能含有空格,否则就被分割成多个了。 ls -F | grep '/$' | grep -v '=' | while read org ## 换用这种方法,可以成功过滤出含有空格的完整目录名 do - echo "#<<<===== entering [[$ROOTPATH/$org]]" + echo "::******** entering [[$ROOTPATH/$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 diff --git a/npm-clear-tree.bat b/npm-clear-tree.bat index 10beb21..73d5bba 100644 --- a/npm-clear-tree.bat +++ b/npm-clear-tree.bat @@ -7,7 +7,7 @@ set ROOTPATH= set ROOTPATH=%1 ) else ( echo; - echo #<<< Enter [root path] or [leave blank] for default to [[%CD%]] + echo ::*** Enter [root path] or [leave blank] for default to [[%CD%]] set /p ROOTPATH=">>> " echo; if "" == "%ROOTPATH%" ( @@ -22,7 +22,7 @@ if not exist "%ROOTPATH%" ( ) pushd %ROOTPATH% -echo #<<< Starting from [[%CD%]] +echo ::*** Starting from [[%CD%]] echo; for /d /r %%r in (*) do ( diff --git a/npm-registry.sh b/npm-registry.sh index f11c113..d825e5b 100644 --- a/npm-registry.sh +++ b/npm-registry.sh @@ -9,10 +9,10 @@ echo nrm ls echo nrm current echo -echo "#<<< npm config get registry ==> $(npm config get registry)" +echo "::*** npm config get registry ==> $(npm config get registry)" echo -echo "#<<< npm config set registry \n [c] China, \n [w] World, [anything else] to quit" -read -p "#>>> " TARGET +echo "::*** npm config set registry \n [c] China, \n [w] World, [anything else] to quit" +read -p "***:: " TARGET if [ "$TARGET" = 'c' ] then npm config set registry https://registry.npmmirror.com @@ -21,4 +21,4 @@ then npm config set registry https://registry.npmjs.org fi echo -echo "#<<< npm config get registry ==> $(npm config get registry)" \ No newline at end of file +echo "::*** npm config get registry ==> $(npm config get registry)" \ No newline at end of file diff --git a/portscan.bat b/portscan.bat index 3c34667..1b1b665 100644 --- a/portscan.bat +++ b/portscan.bat @@ -1,7 +1,7 @@ @ if not "" == "%1" ( set PORT=%1 ) else ( - echo #<<< Enter [port] to scan: + echo ::*** Enter [port] to scan: set /p PORT=">>> " echo; ) diff --git a/portscan.sh b/portscan.sh index 98d4459..54b3f0e 100755 --- a/portscan.sh +++ b/portscan.sh @@ -2,8 +2,8 @@ if [ "$1" ] then PORT=$1 else - echo "#<<< 需要查看的端口号:" - read -p "#>>> " PORT + echo "::*** 需要查看的端口号:" + read -p "***:: " PORT fi if [ "$(uname)" = "Darwin" ] diff --git a/proxy.bat b/proxy.bat index f2b1f23..609a7de 100644 --- a/proxy.bat +++ b/proxy.bat @@ -1,7 +1,7 @@ @REM 在 powershell 里,只要 ssr 打开全局模式,不需要设置 proxy 就可以。 @REM 在 cmd 里,需要设置 proxy 才可以。 -echo #<<< Enter [s] to start, [t] to terminate or [anything else] for no change +echo ::*** Enter [s] to start, [t] to terminate or [anything else] for no change set /p TODOMODE=">>> " echo; if "s" == "%TODOMODE%" ( diff --git a/proxy.sh b/proxy.sh index e4b574e..bf579fd 100755 --- a/proxy.sh +++ b/proxy.sh @@ -1,12 +1,12 @@ #!/bin/bash -echo "#<<< Please run with 'source proxy.sh', otherwise it has no effect on the current shell" +echo "::*** Please run with 'source proxy.sh', otherwise it has no effect on the current shell" if [ -n "$1" ]; then proxySwitch="$1" else - echo "#<<< 开启或关闭网络代理? [s/1] for start, [t/0] for terminate, [anything else] for no change." - read -p "#>>> " proxySwitch + echo "::*** 开启或关闭网络代理? [s/1] for start, [t/0] for terminate, [anything else] for no change." + read -p "***:: " proxySwitch fi # to reset port to empty, otherwise the second run of this script will not ask for port. @@ -14,10 +14,10 @@ PORT= PORTDEFAULT=20170 # function proxy() { if [ "$proxySwitch" == "s" ] || [ "$proxySwitch" == "1" ]; then - echo "#<<< Proxy server running on [port number] or [leave blank] for default $PORTDEFAULT (20170 for v2ray2, or 7897 for clash verge)" + echo "::*** Proxy server running on [port number] or [leave blank] for default $PORTDEFAULT (20170 for v2ray2, or 7897 for clash verge)" while [ ! "$PORT" ] do - read -p "#>>> " PORT + read -p "***:: " PORT if [ ! "$PORT" ] then PORT=$PORTDEFAULT diff --git a/rclone-starter.sh b/rclone-starter.sh index d4f56f0..dabfa88 100644 --- a/rclone-starter.sh +++ b/rclone-starter.sh @@ -1,7 +1,7 @@ #!/bin/bash -echo "#<<< rclone [i] to install, [s] to sync, [c] to copy, [w] to web gui, [else] to quit" -read -p "#>>> " ACTION_TYPE +echo "::*** rclone [i] to install, [s] to sync, [c] to copy, [w] to web gui, [else] to quit" +read -p "***:: " ACTION_TYPE if [ "$ACTION_TYPE" = 'i' ] then sudo -v ; curl https://rclone.org/install.sh | sudo bash @@ -16,30 +16,30 @@ then fi echo - echo "#<<< from source (default ./)"; read -p "#>>> " SOURCE_PATH; if [ ! "$SOURCE_PATH" ]; then SOURCE_PATH="./"; fi + echo "::*** from source (default ./)"; read -p "***:: " SOURCE_PATH; if [ ! "$SOURCE_PATH" ]; then SOURCE_PATH="./"; fi echo while [ ! "$TARGET_PATH" ] do - echo "#<<< to target [remote:path]" - read -p "#>>> " TARGET_PATH + echo "::*** to target [remote:path]" + read -p "***:: " TARGET_PATH done - # read -p "rclone $RC_CMD with max-age #>>> " MAX_AGE ## 发现用了 max-age 并没有提升速度,反而略有下降,即使对大量现有文件和少量更新文件 + # read -p "rclone $RC_CMD with max-age ***:: " MAX_AGE ## 发现用了 max-age 并没有提升速度,反而略有下降,即使对大量现有文件和少量更新文件 echo echo "excluding files and folders (folders must end with /)" - read -p "#>>> " EXCLUDING; + read -p "***:: " EXCLUDING; echo echo "with [number] files in parallel, default 4" - read -p "#>>> " TRANSFERS; + read -p "***:: " TRANSFERS; if [ ! "$TRANSFERS" ]; then TRANSFERS=4; fi echo echo "with [number] threads simultaneously, default 4"; - read -p "#>>> " THREADS; + read -p "***:: " THREADS; if [ ! "$THREADS" ]; then THREADS=4; fi FULL_CMD="rclone $RC_CMD $SOURCE_PATH $TARGET_PATH -P -L --transfers=$TRANSFERS --multi-thread-streams=$THREADS --create-empty-src-dirs --exclude=._* --exclude=.DS_Store --exclude={node_modules/,.deploy_git/,unpackage/,$EXCLUDING}" @@ -50,7 +50,7 @@ then echo "*****************************" echo echo "Starting? [y] for yes, [anything else] for quit" - read -p "#>>> " YES_OR_NOT + read -p "***:: " YES_OR_NOT echo if [ "$YES_OR_NOT" = 'y' ] then diff --git a/rename-host.sh b/rename-host.sh index b2c98d0..153b8bd 100755 --- a/rename-host.sh +++ b/rename-host.sh @@ -2,8 +2,8 @@ if [ $1 ] then NewHostname=$1 else - echo "#<<< Set [new hostname] or [leave blank] for no change" - read -p "#>>> " NewHostname + echo "::*** Set [new hostname] or [leave blank] for no change" + read -p "***:: " NewHostname fi if [ $NewHostname ] @@ -11,6 +11,6 @@ then hostnamectl set-hostname $NewHostname sed -i "s|\b$`hostname`\b|$NewHostname|g" /etc/hosts # echo "127.0.0.1 $NewHostname" >> /etc/hosts else - echo 'Nothing changed #>>>' + echo 'Nothing changed' fi echo diff --git a/scp-pubkey-to-remote.bat b/scp-pubkey-to-remote.bat index ca16c2f..ab845ca 100644 --- a/scp-pubkey-to-remote.bat +++ b/scp-pubkey-to-remote.bat @@ -1,6 +1,6 @@ @echo off -echo #<<< Append ~/.ssh/id_rsa.pub to remote server +echo ::*** Append ~/.ssh/id_rsa.pub to remote server @ if not "%1" == "" ( set REMOTEHOST=%1 diff --git a/scp-pubkey-to-remote.sh b/scp-pubkey-to-remote.sh index 7f2640b..2c49024 100755 --- a/scp-pubkey-to-remote.sh +++ b/scp-pubkey-to-remote.sh @@ -6,8 +6,8 @@ if [ $1 ] then REMOTEHOST=$1 else - echo "#<<< Enter << user@remotehost >> to connect to:" - read -p "#>>> " REMOTEHOST + echo "::*** Enter << user@remotehost >> to connect to:" + read -p "***:: " REMOTEHOST fi scp ~/.ssh/id_rsa.pub $REMOTEHOST:~/tmp.pub diff --git a/seafile-cli-install.sh b/seafile-cli-install.sh index 310c898..b5ef989 100755 --- a/seafile-cli-install.sh +++ b/seafile-cli-install.sh @@ -4,7 +4,7 @@ sudo apt update sudo apt install -y seafile-cli echo "To initialze the client, create a settings folder at [settings path] or [leave blank] for default '~/seafile-client'" -read -p "#>>> " SETTINGS_FOLDER +read -p "***:: " SETTINGS_FOLDER if [ ! $SETTINGS_FOLDER ] then SETTINGS_FOLDER = ~/seafile-client diff --git a/seafile-ignore-find2merge.bat b/seafile-ignore-find2merge.bat index 74a483b..335acfc 100644 --- a/seafile-ignore-find2merge.bat +++ b/seafile-ignore-find2merge.bat @@ -7,7 +7,7 @@ set ROOTPATH= set ROOTPATH=%1 ) else ( echo; - echo #<<< Enter [root path] or [leave blank] for default [[%CD%]] to start tree search for seafile-ignore.txt files + echo ::*** Enter [root path] or [leave blank] for default [[%CD%]] to start tree search for seafile-ignore.txt files set /p ROOTPATH=">>> " echo; if "" == "%ROOTPATH%" ( @@ -23,7 +23,7 @@ if not exist "%ROOTPATH%" ( echo √√√ ROOTPATH = [[%ROOTPATH%]] ) -echo #<<< Enter [path to seafile-ignore.global.txt] or [leave blank] for default [[https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt]] +echo ::*** Enter [path to seafile-ignore.global.txt] or [leave blank] for default [[https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt]] set /p IGNOREPATH=">>> " echo; if "" == "%IGNOREPATH%" ( @@ -39,7 +39,7 @@ if "" == "%IGNOREPATH%" ( ) pushd %ROOTPATH% -echo #<<< Starting from [[%CD%]] +echo ::*** Starting from [[%CD%]] echo; for /d /r %%r in (*) do ( diff --git a/seafile-ignore-find2merge.sh b/seafile-ignore-find2merge.sh index 4a2df37..da3b22b 100644 --- a/seafile-ignore-find2merge.sh +++ b/seafile-ignore-find2merge.sh @@ -8,8 +8,8 @@ if [ -d "$1" ] then ROOTPATH=$1 else - echo "#<<< Enter [root path] or [leave blank] for default [[`pwd`]] to start tree search for seafile-ignore.txt files" - read -p "#>>> " ROOTPATH + echo "::*** Enter [root path] or [leave blank] for default [[`pwd`]] to start tree search for seafile-ignore.txt files" + read -p "***:: " ROOTPATH if [ "$ROOTPATH" ] then ROOTPATH=$(realpath $ROOTPATH) @@ -26,8 +26,8 @@ else fi echo "" -echo "#<<< Enter [path to seafile-ignore.global.txt] or [leave blank] for default [[https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt]]" -read -p "#>>> " IGNOREPATH +echo "::*** Enter [path to seafile-ignore.global.txt] or [leave blank] for default [[https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt]]" +read -p "***:: " IGNOREPATH if [ "$IGNOREPATH" ] then if [ -d "$IGNOREPATH" ] @@ -46,8 +46,8 @@ else fi echo "" -echo "#<<< Enter [y] to start updating, or [anything else] to quit" -read -p "#>>> " YESNO +echo "::*** Enter [y] to start updating, or [anything else] to quit" +read -p "***:: " YESNO if [ "$YESNO" != 'y' ] then exit diff --git a/seafile-ignore-merge-here.sh b/seafile-ignore-merge-here.sh index 46242aa..ac22da7 100644 --- a/seafile-ignore-merge-here.sh +++ b/seafile-ignore-merge-here.sh @@ -1,6 +1,6 @@ #!/bin/bash -echo #<<< Merge remote [seafile-ignore.global.txt] and local [seafile-ignore.local.txt] to [seafile-ignore.txt] +echo ::*** Merge remote [seafile-ignore.global.txt] and local [seafile-ignore.local.txt] to [seafile-ignore.txt] curl -sSL https://git.faronear.org/npm/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt > seafile-ignore.txt if [ -f seafile-ignore.local.txt ]; then cat seafile-ignore.local.txt >> seafile-ignore.txt; fi echo diff --git a/ssh.sh b/ssh.sh index 0fdfabd..c670b53 100644 --- a/ssh.sh +++ b/ssh.sh @@ -36,12 +36,14 @@ if [ "$1" -ge 0 ] 2>/dev/null && [ "$1" -le ${#hosts[@]} ] 2>/dev/null then selected_index=$1-1 else - echo "Select a target to connect via SSH:" + echo "Select a target to connect via SSH, or press 0 to exit:" select target in "${labels[@]}" do if [[ -n "$target" ]]; then selected_index=$REPLY-1 break + elif [ "$REPLY" = '0' ]; then + exit 0 else echo "Invalid selection. Try again." fi @@ -61,13 +63,18 @@ then port=22 fi -if [ "$password" != "" ] & [ "$(which sshpass)" != "" ] +echo "::*** Coonecting to ${label}" +if [ "$password" != "null" ] then - echo "#<<< Coonecting to ${label} with password" - echo "#>>> ssh -X -p $port $username@$host" - sshpass -p $password ssh -X -p $port "$username@$host" $2 + if [ "$(which sshpass)" ] + then + echo "::*** sshpass -p $password -X -p $port $username@$host" + sshpass -p $password ssh -X -p $port "$username@$host" $2 + else + echo "::*** ssh -X -p $port $username@$host" + ssh -X -p $port "$username@$host" $2 + fi else - echo "#<<< Coonecting to ${label} with private key" - echo "#>>> ssh -X -p $port $username@$host" + echo "::*** ssh -X -p $port $username@$host" ssh -X -p $port "$username@$host" $2 fi \ No newline at end of file diff --git a/uniapp-cli.sh b/uniapp-cli.sh index 8940ead..1696297 100755 --- a/uniapp-cli.sh +++ b/uniapp-cli.sh @@ -1,11 +1,11 @@ #!/bin/bash -echo #<<< 把 HBuilder 创建的 uniapp 应用转换成 vue-cli 应用的脚手架。 -echo #<<< More info at https://uniapp.dcloud.net.cn/quickstart-cli.html +echo ::*** 把 HBuilder 创建的 uniapp 应用转换成 vue-cli 应用的脚手架。 +echo ::*** More info at https://uniapp.dcloud.net.cn/quickstart-cli.html -echo #<<< CLI project name? -read -p '##>>> ' PROJECT +echo ::*** CLI project name? +read -p '#***:: ' PROJECT if [ $PROJECT ] then @@ -13,14 +13,14 @@ then vue create -p dcloudio/uni-preset-vue $PROJECT cd $PROJECT mv src src-old - echo #<<< Originial Repository URL? - read -p '#>>> ' $url + echo ::*** Originial Repository URL? + read -p '***:: ' $url echo - echo #<<< 下载一个 HBuilderX 创建的项目下载存为 src 目录: + echo ::*** 下载一个 HBuilderX 创建的项目下载存为 src 目录: echo git clone $url src echo - echo #<<< 进入 src 安装依赖库 + echo ::*** 进入 src 安装依赖库 cd src npm run boot cd ..