这些天我正在学习 AWK 以进行文本处理。但是我对 AWK 语法非常困惑。我在维基百科上读到语法遵循这种格式:
(conditions) {actions}
Run Code Online (Sandbox Code Playgroud)
我假设我可以在 BEGIN 和 END 块中遵循相同的语法。但是当我运行以下脚本时出现语法错误。
awk 'BEGIN{}
(1 == 1) {print "hello";}
END{
(1==1) {print "ended"}}' $1
Run Code Online (Sandbox Code Playgroud)
但是,如果我在 END 块内进行一些更改并在条件前添加“if”,则它运行得很好。
awk 'BEGIN{}
(1 == 1) {print "hello";}
END{
if (1==1) {print "ended"}}' $1
Run Code Online (Sandbox Code Playgroud)
为什么必须在 END 块中写入 'if' 而在普通块中不需要它?
我在我的 android 上的 chroot 环境中使用 Debian。由于我根本不使用 GUI,我认为最好卸载与 GUI 相关的软件包以释放空间。
作为对@Arpit Agarwal 评论的回应,这里是 android 上 debian 安装程序的链接。 在 termux 上的 debian
apt purge libx11-6 libwayland-client0:
Reading package lists...
Building dependency tree...
Reading state information...
Package 'libwayland-client0' is not installed, so not removed
The following packages were automatically installed and are no longer required:
aglfn fontconfig fontconfig-config fonts-dejavu-core fonts-droid-fallback
fonts-liberation fonts-noto-mono ghostscript gnuplot-data gsfonts
hicolor-icon-theme imagemagick-6-common info java-common krb5-locales
libaec0 libamd2 libarpack2 libasound2 libasound2-data libauthen-sasl-perl
libavahi-client3 …Run Code Online (Sandbox Code Playgroud) 我们可以找到有关大多数命令的帮助,例如echo、cp、mv、wget使用man。
但是我可以找到用于管道(| 符号)等操作的特殊字符的手册吗?如果没有,是否有任何关于此的官方文档?
我正在检查 .bashrc 来设置 ls 命令的颜色,发现了这个
export SHELL='/bin/bash'
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'Run Code Online (Sandbox Code Playgroud)dircolors如果我使用而不是与 一起使用
会有什么问题吗eval?有什么不同? 我想使用 FISH 外壳。但我读过 FISH 不是 POSIX shell,因此chsh不建议将其设置为默认 shell 。我想要的是每当我启动 xfce4-terminal 我想启动 FISH shell 而不是 bash。添加exec fish到.bashrc似乎是一个解决方案,但我想知道是否有一种方法可以启动鱼而无需在 bash 之上启动它。