sudo cast
48 subscribers
498 photos
12 videos
16 files
1.54K links
v2 @sudo_recast

casted something nice or not

v1 / cast / channel / telegram / sudo

more @sudo_radio
email telegram@gadflysu.com
Download Telegram
$HOME vs. ~ (tilde)
https://newbedev.com/difference-between-home-and-tilde

The tilde is part of a shell expansion (like in bash, csh, zsh, etc). The $HOME variable is exportable and can be used independent of a specific shell.

The shell replaces ~ with the user's home directory (update: or perhaps by the home directory of some other user, if ~ is followed by something other than a /), but only if it's the first character of a word.

#shell
source vs. . (dot)
https://ss64.com/bash/source.html

source is a synonym for dot/period '.' in bash, but not in POSIX sh, so for maximum compatibility use the period.

When a script is run using source it runs within the existing shell, any variables created or modified by the script will remain available after the script completes.

E.g. https://github.com/nvm-sh/nvm/blob/eed0d0e85ccb35e8802b0df7061491e6cf5d6a4b/README.md

#shell
eval is a built-in Linux command which is used to execute arguments as a shell command. It combines arguments into a single string and uses it as an input to the shell and execute the commands.

https://www.geeksforgeeks.org/eval-command-in-linux-with-examples/

#shell
我没有在 .zshrc 设定语言区域,而 ssh 配置默认发送环境变量 SendEnv LANG LC_*。虚拟终端 Terminal.app 和 iTerm.app 会设定环境变量 LC_CTYPE=UTF-8,这对 macOS 有效,但对 Linux 无效。这导致远程 Linux 主机 #shell 中的一些字符显示异常。

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=
LANGUAGE=
LC_CTYPE=UTF-8
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
抓取 (reparent) 一个运行中的程序到当前终端(一直想要这个功能……):

echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
reptyr PID


via https://t.me/MiaoTonyChannel/2242
#shell