From c063e02f1ed1837c29f04fd6221e6794eebb837e Mon Sep 17 00:00:00 2001 From: Luk Date: Fri, 13 Dec 2024 20:09:17 +0800 Subject: [PATCH] change "echo ===" to "echo #<<<" to avoid confusing when searching for === --- acme-setup.sh | 28 ++++++------- conda-init.sh | 17 +++++--- conda-install.sh | 2 + cpu-test-by-pi.sh | 4 +- debian-add-user.sh | 8 ++-- debian-ddinstall-debi.sh | 14 +++---- debian-setup.Dockerfile | 2 +- debian-setup.sh | 38 ++++++++--------- debian-version.sh | 14 +++---- docker-allow-user.sh | 4 +- docker-install.sh => docker-install-debian.sh | 13 +++--- docker-install-ubuntu.sh | 16 +++++++ docker-search-tags.sh | 10 ++--- expect-ssh2server.sh | 6 +-- find-and-run-recursively.sh | 12 +++--- geth-install.sh | 8 ++-- geth-prepare.sh | 14 +++---- geth-run.sh | 10 ++--- git-config.sh | 14 +++---- git-ignore-find2merge.bat | 6 +-- git-ignore-find2merge.sh | 12 +++--- git-ignore-merge-here.sh | 2 +- git-pull-tree.bat | 10 ++--- git-pull-tree.sh | 10 ++--- git-push-tree.bat | 12 +++--- git-push-tree.sh | 18 ++++---- git-rename-branch.bat | 4 +- git-rename-branch.sh | 10 ++--- git-repo-change-hook-path.sh | 16 +++---- gitea-run.sh | 4 +- gogs-run.sh | 6 +-- ipfs-install.sh | 4 +- mac-brew-default-apps.sh => mac-brew-apps.sh | 10 ++--- mac-brew-mirror.sh | 4 +- mac-resize-launchpad.sh | 8 ++-- nixhome-config.sh | 42 +++++++++---------- nixhome/.bashrc | 25 +++++++++-- nixhome/.npmrc_taobao | 1 - nixhome/seafile-ignore.global.txt | 5 +++ nodejs-install.sh | 4 +- npm-boot-tree.bat | 10 ++--- npm-boot-tree.sh | 8 ++-- npm-clear-tree.bat | 4 +- npm-registry.sh | 8 ++-- portscan.bat | 2 +- portscan.sh | 4 +- proxy.bat | 2 +- proxy.sh | 14 +++---- rclone-starter.sh | 20 ++++----- rename-host.sh | 6 +-- scp-pubkey-to-remote.bat | 2 +- scp-pubkey-to-remote.sh | 4 +- seafile-cli-install.sh | 2 +- seafile-ignore-find2merge.bat | 6 +-- seafile-ignore-find2merge.sh | 12 +++--- seafile-ignore-merge-here.sh | 2 +- ssh-run.sh => ssh.sh | 24 +++++++++-- uniapp-cli.sh | 16 +++---- 58 files changed, 328 insertions(+), 265 deletions(-) create mode 100644 conda-install.sh rename docker-install.sh => docker-install-debian.sh (81%) mode change 100755 => 100644 create mode 100644 docker-install-ubuntu.sh rename mac-brew-default-apps.sh => mac-brew-apps.sh (50%) delete mode 100644 nixhome/.npmrc_taobao rename ssh-run.sh => ssh.sh (70%) diff --git a/acme-setup.sh b/acme-setup.sh index d55aee1..4597870 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/conda-init.sh b/conda-init.sh index f9e0da7..03de44c 100644 --- a/conda-init.sh +++ b/conda-init.sh @@ -1,13 +1,13 @@ # >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! -# __conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" +# __conda_setup="$('/usr/local/Caskroom/miniconda/base/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" # if [ $? -eq 0 ]; then # eval "$__conda_setup" # else -# if [ -f "$(brew --repo)/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then -# . "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" +# if [ -f "/usr/local/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then +# . "/usr/local/Caskroom/miniconda/base/etc/profile.d/conda.sh" # else -# export PATH="/opt/homebrew/Caskroom/miniconda/base/bin:$PATH" +# export PATH="/usr/local/Caskroom/miniconda/base/bin:$PATH" # fi # fi # unset __conda_setup @@ -15,5 +15,12 @@ echo "Please run this script with 'source', otherwise it won't take effect in the current shell." -source "$(brew --repo)/Caskroom/miniconda/base/etc/profile.d/conda.sh" +if [ -f "/usr/local/Caskroom/miniconda/base/etc/profile.d/conda.sh" ] +then + source "/usr/local/Caskroom/miniconda/base/etc/profile.d/conda.sh" +elif [ -f "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" ] +then + source "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" +fi + conda activate base diff --git a/conda-install.sh b/conda-install.sh new file mode 100644 index 0000000..be59931 --- /dev/null +++ b/conda-install.sh @@ -0,0 +1,2 @@ +curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh +bash ./Miniconda3-latest-Linux-x86_64.sh \ No newline at end of file diff --git a/cpu-test-by-pi.sh b/cpu-test-by-pi.sh index c204801..b4b2bac 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 643790e..333de7b 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 9da8087..2172c2c 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.Dockerfile b/debian-setup.Dockerfile index 81f8b80..57a0129 100644 --- a/debian-setup.Dockerfile +++ b/debian-setup.Dockerfile @@ -2,7 +2,7 @@ FROM debian:11.5 LABEL org.opencontainers.image.authors="luk" RUN apt update && apt install curl -y -RUN curl https://git.faronear.org/npm/sysconfig/raw/branch/main/debian-setup.sh > ~/debian-setup.sh && echo -e "l\n\n\n\n\n" | bash ~/debian-setup.sh +RUN curl https://git.tic.cc/npm/sysconfig/raw/branch/main/debian-setup.sh > ~/debian-setup.sh && echo -e "l\n\n\n\n\n" | bash ~/debian-setup.sh CMD bash diff --git a/debian-setup.sh b/debian-setup.sh index 7ec125c..105332e 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 3878ced..de6baad 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 b6e1d0c..0c876a6 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.sh b/docker-install-debian.sh old mode 100755 new mode 100644 similarity index 81% rename from docker-install.sh rename to docker-install-debian.sh index 8d88f74..334c9f3 --- a/docker-install.sh +++ b/docker-install-debian.sh @@ -6,8 +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 "=== 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 @@ -48,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 @@ -61,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-install-ubuntu.sh b/docker-install-ubuntu.sh new file mode 100644 index 0000000..08a1216 --- /dev/null +++ b/docker-install-ubuntu.sh @@ -0,0 +1,16 @@ +sudo apt update + +sudo apt install apt-transport-https ca-certificates curl software-properties-common + +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + +sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + +sudo apt update + +sudo apt install docker-ce + +sudo systemctl start docker +sudo systemctl enable docker + +sudo docker --version \ No newline at end of file diff --git a/docker-search-tags.sh b/docker-search-tags.sh index 68a6e05..9c5884a 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 8c437ad..31798f8 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 @@ -59,5 +59,5 @@ else read -p "root password = " ROOT_SU done - expect ~/faronear/npm/sysconfig/expect-ssh.sh $HOST $USER $PWD_USER $PWD_SU + expect ~/sysconfig/expect-ssh.sh $HOST $USER $PWD_USER $PWD_SU fi diff --git a/find-and-run-recursively.sh b/find-and-run-recursively.sh index 1da6a65..9b9e0c4 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 ">>> " 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 ">>> " 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 ">>> " 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 0ca705a..3a2b07d 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 8b1bedc..758191e 100755 --- a/geth-prepare.sh +++ b/geth-prepare.sh @@ -1,16 +1,16 @@ #!/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 fi -echo "*** DATADIR === $DATADIR " +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 c30df6b..a0df107 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 d98261d..e605b33 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 880ba7e..090b30c 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 3cb030f..9ec70f6 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 c3dd2d2..38acf64 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 a89e6d1..e045d96 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 6e48026..1d930ed 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 339a236..50ec36c 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,13 +37,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 [[%ROOTPATH%\%%o]] ======== + echo #<<<== entering [[%ROOTPATH%\%%o]] echo; pushd "%%o" for /d %%g in (*) do ( if exist %%g\.git ( pushd "%%g" - echo ---- git commit and push [[%ROOTPATH%\%%o\%%g]] ---- + echo #---- git commit and push [[%ROOTPATH%\%%o\%%g]] git add . && git commit -m "%COMMIT_MESSAGE%" && git push echo; popd @@ -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 7120741..fb72211 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 441cbba..6c30b95 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 125baaf..057227e 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 33356d2..2e1b16e 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 c261d5b..3d3cb1d 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 19e0314..de1e7dd 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 b566efc..05c880f 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-default-apps.sh b/mac-brew-apps.sh similarity index 50% rename from mac-brew-default-apps.sh rename to mac-brew-apps.sh index 440a9ee..b355f0f 100644 --- a/mac-brew-default-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=(jq openssl pandoc rclone speedtest-cli yt-dlp) +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 @@ -15,11 +15,11 @@ do echo done -caskList=(appcleaner avidemux baidunetdisk cloudflare-warp cursor discord douyin drawio emacs futubull iina iterm2 lx-music miniconda obs poe qq seafile-client shotcut spacelauncher sqlitestudio telegram-desktop telegram-lite termius thunder warp wechat) +caskList=(appcleaner avidemux baidunetdisk cloudflare-warp cursor discord douyin drawio emacs futubull mysql-client iina iterm2 lx-music miniconda obs poe qq seafile-client shotcut spacelauncher sqlitestudio telegram-desktop termius thunder warp wechat xquartz) 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 5f963a7..47a0764 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 f5b2a27..2d366e1 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 6751cbf..506f74f 100755 --- a/nixhome-config.sh +++ b/nixhome-config.sh @@ -1,32 +1,28 @@ #!/bin/bash -NIXHOME0=/faronear/sysconfig/nixhome -NIXHOME1=~/sysconfig/nixhome -NIXHOME2=`pwd`/nixhome - if [ -d "$1" ] then NIXHOME=$1 -elif [ -d $NIXHOME0 ] +else if [ -d "`pwd`/nixhome" ] then - NIXHOME=$NIXHOME0 -elif [ -d $NIXHOME1 ] -then - NIXHOME=$NIXHOME1 -elif [ -d $NIXHOME2 ] -then - NIXHOME=$NIXHOME2 + NIXHOME=`pwd`/nixhome else - echo ××× none of the testing path is valid. - echo "=== Enter [nixhome path] or leave [blank] to exit" - read -p ">>> " NIXHOME echo "" - if [ ! -d "$NIXHOME" ] - then - echo "××× nixhome path [[$NIXHOME]] not available! Exit now. ×××" - exit + echo "#<<< Enter [root path] or [leave blank] for default to [[`pwd`]]" + read -p "#>>> " NIXHOME + if [ ! "$NIXHOME" ] + then + NIXHOME=`pwd` fi fi +if [ ! -e "$NIXHOME/.bashrc" ] +then + echo "××× [[$NIXHOME/.bashrc]] not exist! Exit now. ***" + exit +else + echo "√√√ NIXHOME = [[$NIXHOME]]" +fi +echo "" # $2 应当为用户名 if [ "$2" == 'root' ] @@ -50,8 +46,8 @@ then 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 + 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 @@ -108,8 +104,8 @@ 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 diff --git a/nixhome/.bashrc b/nixhome/.bashrc index f8af92e..00d9d89 100644 --- a/nixhome/.bashrc +++ b/nixhome/.bashrc @@ -46,7 +46,7 @@ alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' alias su='su -' alias npmc='npm --registry https://registry.npmmirror.com' -alias npmr='npm --silent run' +alias npmr='npm -s run' alias curlw='curl -sSL -o /dev/null -w "%{http_code} | %{time_total} s | %{size_download} bytes | %{url_effective}\n"' if [ "$(uname)" = "Darwin" ] then @@ -112,9 +112,28 @@ if [ -n "$force_color_prompt" ]; then fi fi -# color starts with \[\033[${ColorCode}m\] and ends with \[\033[00m\], in which the $ColorCode is `$Style$Type$Code`, for example, $Style=01; means text in bold, $Type=3 means text color, $Type=4 means background color, $Code could be 0-7 for pre-defined colors. +# color starts with \[\033[${ColorCode}m\] and ends with \[\033[00m\], in which the $ColorCode is `$Style;$Type$Color`: +# $Style: text style +# - `00`: Default style +# - `01`: Bold/Bright +# - `04`: Underlined +# - `05`: Blink (may not work in all terminals) +# - `07`: Inverse +# - `08`: Hidden +# $Type: +# - `3`: text +# - `4`: background +# $Color: color +# - `0`: Black +# - `1`: Red +# - `2`: Green +# - `3`: Yellow +# - `4`: Blue +# - `5`: Magenta +# - `6`: Cyan +# - `7`: White if [ "$color_prompt" = yes ]; then - PS1='<\[\033[01;42m\]\t\[\033[00m\]#\[\033[01;43m\]\u\[\033[00m\]@\[\033[01;46m\]\h\[\033[00m\]:\[\033[01;41m\]\w\[\033[00m\]> ' + PS1='<\[\033[01;42m\]\t\[\033[00m\]#\[\033[01;45m\]\u\[\033[00m\]@\[\033[01;41m\]\h\[\033[00m\]:\[\033[01;41m\]\w\[\033[00m\]> ' else PS1='<\t#\u@\h:\w> ' fi diff --git a/nixhome/.npmrc_taobao b/nixhome/.npmrc_taobao deleted file mode 100644 index 7549542..0000000 --- a/nixhome/.npmrc_taobao +++ /dev/null @@ -1 +0,0 @@ -registry=https://registry.npmmirror.com diff --git a/nixhome/seafile-ignore.global.txt b/nixhome/seafile-ignore.global.txt index f761786..c76ac0f 100644 --- a/nixhome/seafile-ignore.global.txt +++ b/nixhome/seafile-ignore.global.txt @@ -22,6 +22,8 @@ *.nosf/ *.nosf.*/ +.Trash/ + .DS_Store */.DS_Store @@ -54,6 +56,9 @@ pages4loader.json5 .deploy_git/ */.deploy_git/ +# next.js 项目 +.next/ + # HBuilder 目录 unpackage/ */unpackage/ diff --git a/nodejs-install.sh b/nodejs-install.sh index ce9cfdc..bc2c662 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 5994ba8..d528a6e 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 687f188..0fc4a65 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,7 +30,7 @@ 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 * 是分割成一个个目录名的,即使目录名含有空格 @@ -40,7 +40,7 @@ then 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 e9ab61d..10beb21 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 c9ef9bd..f11c113 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 32d27ba..3c34667 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 c8cc4d4..98d4459 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 a11368d..f2b1f23 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 b9b9cbd..e4b574e 100755 --- a/proxy.sh +++ b/proxy.sh @@ -1,26 +1,26 @@ #!/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. PORT= - +PORTDEFAULT=20170 # function proxy() { if [ "$proxySwitch" == "s" ] || [ "$proxySwitch" == "1" ]; then - echo "=== Proxy server running on [port number] or [leave blank] for default 7897" + 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=7897 + PORT=$PORTDEFAULT fi done export all_proxy=socks5://127.0.0.1:$PORT diff --git a/rclone-starter.sh b/rclone-starter.sh index e872dae..d4f56f0 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 d6a41fd..b2c98d0 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 70d4660..ca16c2f 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 c78daa3..7f2640b 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 46466b8..310c898 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 b2da6e6..74a483b 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 be8c5cf..4a2df37 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 338d2c6..46242aa 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-run.sh b/ssh.sh similarity index 70% rename from ssh-run.sh rename to ssh.sh index 8fd8bce..0fdfabd 100644 --- a/ssh-run.sh +++ b/ssh.sh @@ -1,5 +1,7 @@ #!/bin/bash +echo Usage: this_script.sh [selected_index] [to_run_cmd] + # Ensure jq is installed if ! command -v jq &> /dev/null; then echo "jq is required but not installed. Please install jq and run the script again." @@ -24,8 +26,10 @@ fi # Parse the JSON to get labels and corresponding details labels=($(jq -r '.["sshfs.configs"][] | .label' "$SETTINGS_FILE")) hosts=($(jq -r '.["sshfs.configs"][] | .host' "$SETTINGS_FILE")) +ports=($(jq -r '.["sshfs.configs"][] | .port' "$SETTINGS_FILE")) names=($(jq -r '.["sshfs.configs"][] | .name' "$SETTINGS_FILE")) usernames=($(jq -r '.["sshfs.configs"][] | .username' "$SETTINGS_FILE")) +passwords=($(jq -r '.["sshfs.configs"][] | .password' "$SETTINGS_FILE")) privateKeyPaths=($(jq -r '.["sshfs.configs"][] | .privateKeyPath' "$SETTINGS_FILE")) if [ "$1" -ge 0 ] 2>/dev/null && [ "$1" -le ${#hosts[@]} ] 2>/dev/null @@ -47,9 +51,23 @@ fi label="${labels[$selected_index]}" name="${names[$selected_index]}" host="${hosts[$selected_index]}" +port="${ports[$selected_index]}" username="${usernames[$selected_index]}" +password="${passwords[$selected_index]}" privateKeyPath="${privateKeyPaths[$selected_index]}" -echo "=== Coonecting to ${label}" -echo ">>> ssh $username@$host" -ssh "$username@$host" \ No newline at end of file +if [ "$port" = "null" ] +then + port=22 +fi + +if [ "$password" != "" ] & [ "$(which sshpass)" != "" ] +then + echo "#<<< Coonecting to ${label} with password" + echo "#>>> ssh -X -p $port $username@$host" + sshpass -p $password ssh -X -p $port "$username@$host" $2 +else + echo "#<<< Coonecting to ${label} with private key" + 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 3505976..8940ead 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 ..