在 main.py 中添加对 'ls' 和 'll' 命令的支持,默认参数为 '-l'
This commit is contained in:
16
main.py
16
main.py
@@ -74,6 +74,22 @@ def pseudo_zsh():
|
||||
except FileNotFoundError:
|
||||
print(f"cd: no such file or directory: {args[1]}") # 目录不存在
|
||||
continue
|
||||
if args[0] == 'ls':
|
||||
try:
|
||||
if len(args) == 1:
|
||||
args.append('-l') # 默认参数
|
||||
subprocess.run(['ls'] + args[1:]) # 执行 ls 命令
|
||||
except FileNotFoundError:
|
||||
print(f"zsh: command not found: {args[0]}")
|
||||
|
||||
if args[0] == 'll':
|
||||
try:
|
||||
if len(args) == 1:
|
||||
args.append('-l') # 默认参数
|
||||
subprocess.run(['ls'] + args[1:]) # 执行 ll 命令
|
||||
except FileNotFoundError:
|
||||
print(f"zsh: command not found: {args[0]}")
|
||||
|
||||
|
||||
# 伪造 sudo 密码输入并记录
|
||||
|
||||
|
||||
Reference in New Issue
Block a user