威联通ts 532x 篇七 修改shell 命令行 为 zsh + oh-my-zsh
默认ssh是黑白的
系统默认的shell
[admin@YD-TS-532X etc]# echo $SHELL
/bin/sh
查版本
[admin@YD-TS-532X etc]# /bin/sh --version
GNU bash, version 3.2.57(1)-release (aarch64-QNAP-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.
[admin@YD-TS-532X etc]#
PATH文件路径
/etc/profile
Entware 安装完放在 /opt/bin
添加PATH
export PATH=/opt/bin:$PATH
让环境变量立即生效需要执行如下命令:
#source /etc/profile
用 echo命令查看添加/opt/bin成功
添加后可以查看opkg 安装情况
[admin@YD-TS-532X etc]# opkg --version
opkg version 1bf042dd06751b693a8544d2317e5b969d666b69 (2021-06-13)
[admin@YD-TS-532X etc]#
先更新opkg
再安装zsh
[admin@YD-TS-532X etc]# opkg update
Downloading http://bin.entware.net/aarch64-k3.10/Packages.gz
Updated list of available packages in /opt/var/opkg-lists/entware
[admin@YD-TS-532X etc]# opkg install zsh
检查安装成功
离线安装oh-my-zsh
参考资料
参考资料有资源下载。
为啥离线安装,在线安装各种问题,最后找到这个办法
去github下载 mirrors-oh-my-zsh-master.zip
然后整个压缩包解压到homes/用户名下,并重新命名为.oh-my-zsh
修改文件名后在windows下会隐藏文件夹,查看方法
替换安装文件install.sh
记事本把下面代码保存后改名为install.sh文件,替换掉tools下源文件
install.sh文件修改后内容
#!/bin/sh
#
# This script should be run via curl:
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# or wget:
# sh -c "$(wget -qO- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
#
# As an alternative, you can first download the install script and run it afterwards:
# wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
# sh install.sh
#
# You can tweak the install behavior by setting variables when running the script. For
# example, to change the path to the Oh My Zsh repository:
# ZSH=~/.zsh sh install.sh
#
# Respects the following environment variables:
# ZSH - path to the Oh My Zsh repository folder (default: $HOME/.oh-my-zsh)
# REPO - name of the GitHub repo to install from (default: robbyrussell/oh-my-zsh)
# REMOTE - full remote URL of the git repo to install (default: GitHub via HTTPS)
# BRANCH - branch to check out immediately after install (default: master)
#
# Other options:
# CHSH - 'no' means the installer will not change the default shell (default: yes)
# RUNZSH - 'no' means the installer will not run zsh after the install (default: yes)
#
# You can also pass some arguments to the install script to set some these options:
# --skip-chsh: has the same behavior as setting CHSH to 'no'
# --unattended: sets both CHSH and RUNZSH to 'no'
# For example:
# sh install.sh --unattended
#
set -e# Default settings
ZSH=${ZSH:-~/.oh-my-zsh}
REPO=${REPO:-robbyrussell/oh-my-zsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git}
BRANCH=${BRANCH:-master}# Other options
CHSH=${CHSH:-yes}
RUNZSH=${RUNZSH:-yes}command_exists() {command -v "$@" >/dev/null 2>&1
}error() {echo ${RED}"Error: $@"${RESET} >&2
}setup_color() {# Only use colors if connected to a terminalif [ -t 1 ]; thenRED=$(printf '\033[31m')GREEN=$(printf '\033[32m')YELLOW=$(printf '\033[33m')BLUE=$(printf '\033[34m')BOLD=$(printf '\033[1m')RESET=$(printf '\033[m')elseRED=""GREEN=""YELLOW=""BLUE=""BOLD=""RESET=""fi
}setup_zshrc() {# Keep most recent old .zshrc at .zshrc.pre-oh-my-zsh, and older ones# with datestamp of installation that moved them aside, so we never actually# destroy a user's original zshrcecho "${BLUE}Looking for an existing zsh config...${RESET}"# Must use this exact name so uninstall.sh can find itOLD_ZSHRC=~/.zshrc.pre-oh-my-zshif [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; thenif [ -e "$OLD_ZSHRC" ]; thenOLD_OLD_ZSHRC="${OLD_ZSHRC}-$(date +%Y-%m-%d_%H-%M-%S)"if [ -e "$OLD_OLD_ZSHRC" ]; thenerror "$OLD_OLD_ZSHRC exists. Can't back up ${OLD_ZSHRC}"error "re-run the installer again in a couple of seconds"exit 1fimv "$OLD_ZSHRC" "${OLD_OLD_ZSHRC}"echo "${YELLOW}Found old ~/.zshrc.pre-oh-my-zsh." \"${GREEN}Backing up to ${OLD_OLD_ZSHRC}${RESET}"fiecho "${YELLOW}Found ~/.zshrc.${RESET} ${GREEN}Backing up to ${OLD_ZSHRC}${RESET}"mv ~/.zshrc "$OLD_ZSHRC"fiecho "${GREEN}Using the Oh My Zsh template file and adding it to ~/.zshrc.${RESET}"cp "$ZSH/templates/zshrc.zsh-template" ~/.zshrcsed "/^export ZSH=/ c\\
export ZSH=\"$ZSH\"
" ~/.zshrc > ~/.zshrc-omztempmv -f ~/.zshrc-omztemp ~/.zshrcecho
}setup_shell() {# Skip setup if the user wants or stdin is closed (not running interactively).if [ $CHSH = no ]; thenreturnfi# If this user's login shell is already "zsh", do not attempt to switch.if [ "$(basename "$SHELL")" = "zsh" ]; thenreturnfi# If this platform doesn't provide a "chsh" command, bail out.if ! command_exists chsh; thencat <<-EOFI can't change your shell automatically because this system does not have chsh.${BLUE}Please manually change your default shell to zsh${RESET}EOFreturnfiecho "${BLUE}Time to change your default shell to zsh:${RESET}"# Prompt for user choice on changing the default login shellprintf "${YELLOW}Do you want to change your default shell to zsh? [Y/n]${RESET} "read optcase $opt iny*|Y*|"") echo "Changing the shell..." ;;n*|N*) echo "Shell change skipped."; return ;;*) echo "Invalid choice. Shell change skipped."; return ;;esac# Check if we're running on Termuxcase "$PREFIX" in*com.termux*) termux=true; zsh=zsh ;;*) termux=false ;;esacif [ "$termux" != true ]; then# Test for the right location of the "shells" fileif [ -f /etc/shells ]; thenshells_file=/etc/shellselif [ -f /usr/share/defaults/etc/shells ]; then # Solus OSshells_file=/usr/share/defaults/etc/shellselseerror "could not find /etc/shells file. Change your default shell manually."returnfi# Get the path to the right zsh binary# 1. Use the most preceding one based on $PATH, then check that it's in the shells file# 2. If that fails, get a zsh path from the shells file, then check it actually existsif ! zsh=$(which zsh) || ! grep -qx "$zsh" "$shells_file"; thenif ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -1) || [ ! -f "$zsh" ]; thenerror "no zsh binary found or not present in '$shells_file'"error "change your default shell manually."returnfififi# We're going to change the default shell, so back up the current oneif [ -n "$SHELL" ]; thenecho $SHELL > ~/.shell.pre-oh-my-zshelsegrep "^$USER:" /etc/passwd | awk -F: '{print $7}' > ~/.shell.pre-oh-my-zshfi# Actually change the default shell to zshif ! chsh -s "$zsh"; thenerror "chsh command unsuccessful. Change your default shell manually."elseexport SHELL="$zsh"echo "${GREEN}Shell successfully changed to '$zsh'.${RESET}"fiecho
}main() {# Run as unattended if stdin is closedif [ ! -t 0 ]; thenRUNZSH=noCHSH=nofi# Parse argumentswhile [ $# -gt 0 ]; docase $1 in--unattended) RUNZSH=no; CHSH=no ;;--skip-chsh) CHSH=no ;;esacshiftdonesetup_colorif ! command_exists zsh; thenecho "${YELLOW}Zsh is not installed.${RESET} Please install zsh first."exit 1fisetup_zshrcsetup_shellprintf "$GREEN"cat <<-'EOF'__ ______ / /_ ____ ___ __ __ ____ _____/ /_/ __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_//____/ ....is now installed!Please look over the ~/.zshrc file to select plugins, themes, and options.p.s. Follow us on https://twitter.com/ohmyzshp.p.s. Get stickers, shirts, and coffee mugs at https://shop.planetargon.com/collections/oh-my-zshEOFprintf "$RESET"if [ $RUNZSH = no ]; thenecho "${YELLOW}Run zsh to try it out.${RESET}"exitfiexec zsh -l
}main "$@"
保存文件,替换原来的install.sh就可以了。具体操作可以看参考资料。
然后就是执行安装
sh install.sh
至此安装成功
查看版本信息,用来检查是否安装成功
[admin@YD-TS-532X etc]# zsh --version
zsh 5.8 (aarch64-openwrt-linux-gnu)
威联通ts 532x 篇七 修改shell 命令行 为 zsh + oh-my-zsh相关推荐
- 调音台docker教程_威联通Docker教程 篇二:三分钟安装精美的音乐播放器 MusicPlayer!Container Station系列教程!...
威联通Docker教程 篇二:三分钟安装精美的音乐播放器 MusicPlayer!Container Station系列教程! 2020-04-15 11:01:02 67点赞 529收藏 47评论 ...
- linux默认csh修改命令,Solaris中默认Shell的修改以及命令行补全的设置
Solaris中默认Shell的修改以及命令行补全的设置 发布时间:2008-02-18 00:01:41来源:红联作者:qtsmy Solaris10 x86虽然可以跑起来,但有很多方面都用这和以前 ...
- 13分页和shell命令行模式
技术交流QQ群:1027579432,欢迎你的加入! 本教程来源于B站杨仕航Django2.0开发视频教程,如需转载,必须注明来源! 1.为什么先讲分页功能 2.快速添加新的博客 shell命令行模式 ...
- linux shell 宏定义_Linux系统和Shell命令行简介,走上数据分析之路
122Linux系统和Shell命令行简介,走上数据分析之路 本节作者:刘永鑫 中国科学院遗传与发育生物学研究所 版本1.0.2,更新日期:2020年8月31日 本项目永久地址:https://git ...
- 122.Linux系统和Shell命令行简介,走上数据分析之路
122Linux系统和Shell命令行简介,走上数据分析之路 本节作者:刘永鑫 中国科学院遗传与发育生物学研究所 版本1.0.2,更新日期:2020年8月31日 本项目永久地址:https://git ...
- linux 脚本编写基本命令,Linux Shell命令行及脚本编程实例详解
<Linux典藏大系:Linux Shell命令行及脚本编程实例详解>共15章,分为两篇.主要内容包括:Linux 及Linux Shell简介.初识Linux Shell.常用Shell ...
- 2021年大数据Hadoop(八):HDFS的Shell命令行使用
2021大数据领域优质创作博客,带你从入门到精通,该博客每天更新,逐渐完善大数据各个知识体系的文章,帮助大家更高效学习. 有对大数据感兴趣的可以关注微信公众号:三帮大数据 目录 HDFS的Shell命 ...
- 快速编辑 Shell 命令行
作者:robinswan 来自:LinuxSir.Org 摘要:对于 Linux / Unix 这类从内核得到整体架构,再到哪怕是最小的一个应用小软件都以文本来支撑的系统,没有娴熟的命令行技巧确实是玩 ...
- 几种在shell命令行中过滤adb logcat输出的方法
几种在shell命令行中过滤adb logcat输出的方法 分类标签: LogCat ADB 我们在Android开发中总能看到程序的log日志内容充满了屏幕,而真正对开发者有意义的信息被淹没在洪流 ...
最新文章
- 神策数据第五届“星斗奖”榜单公布!
- 深入解析JNA—模拟C语言结构体
- 事件驱动数据管理 微服务和分布式数据管理问题
- C++ primer 第7章 类
- 无法打开计算机的组策略,win7系统电脑本地组策略打不开无法运行的解决方法...
- cdh中hue集成hbase_HBase版本 | Cloudera Enterprise 6.2.0发布
- AutoCAD-源泉设计-利器
- [APK签名] .pk8、.x509.pem转化为.keystore签名
- 寻找AR中的Big Difference - v4.0 #AR指南
- 相关系数(Correlation)
- 第二集 第一魂环 第十一章
- 线性代数(numpy.linalg)
- 为什么我说低代码是“行业毒瘤”?
- 苹果手机的微信记录怎么恢复?奉上超好用的恢复技巧,拿走不谢
- 无代码开发平台 有哪些?
- 【技术分享】一:搜索排序—概述
- Arduino使用HC05蓝牙模块与手机连接
- Python 二分查找:bisect库的使用
- 【数据集处理】Python 将图片名字中含有某一字符串的图片存到指定文件夹下
- [CryptoHack] RSA-PRIMES PART1 Write-Up