[root@localhost ~]# vim eof.sh #!/bin/bash mysql -uroot -p123456 <<EOF use test; create table data(name varchar(15),age int,address varchar(25)); desc test.data; insert into data values("tom",23,"china"); select * from data; exit EOF
4.1 运行脚本查看执行结果
1 2 3 4 5 6 7 8 9
[root@localhost ~]# bash eof.sh //运行脚本,查看数据库中信息 mysql: [Warning] Using a password on the command line interface can be insecure. Field Type Null Key Default Extra name varchar(15) YES NULL age int(11) YES NULL address varchar(25) YES NULL
cat << "EOF" > ~/.gitconfig # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. # Initialization code that may require console input (password prompts, [y/n] # confirmations, etc.) must go above this block; everything else may go below. if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then source"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme EOF
在Zsh中实现快速路径跳转,
之前已经介绍了z.lua(Zsh配置快速路径跳转)。今天看到了另一个zsh的插件zoxide,
它是用rust语言写的,所以效率上应当是更高的。至于为什么会由z.lua切换到zoxide,
这里我也想不出更好的理由,但是大家可以参考文章zoxide VS
z.lua和zsh-z VS
zoxide, 今天我是做为尝试而切换到zoxide,
当然z.lua依然优秀。
zoxide 简介
zoxide is a
smarter cd command, inspired by z and autojump.
It remembers which directories you use most frequently, so you can
"jump" to them in just a few keystrokes.zoxide works on all major
shells.
Getting started
1 2 3 4 5 6 7 8 9 10 11 12
z foo # cd into highest ranked directory matching foo z foo bar # cd into highest ranked directory matching foo and bar z foo / # cd into a subdirectory starting with foo
z ~/foo # z also works like a regular cd command z foo/ # cd into relative path z .. # cd one level up z - # cd into previous directory
zi foo # cd with interactive selection (using fzf)
z foo<SPACE><TAB> # show interactive completions (zoxide v0.8.0+, bash 4.4+/fish/zsh only)
Installation
install zoxide
1
sudo pacman -S zoxide
Configure
~/.zshrc
1 2 3 4 5 6
# set for zsh-z-git # source /usr/share/zsh/plugins/zsh-z/zsh-z.plugin.zsh # set for z.lua 功能上不如zsh-z-git完善 # eval "$(lua /usr/share/z.lua/z.lua --init zsh enhanced once)" # set for zoxide instead of z.lua eval"$(zoxide init zsh)"