小编Jon*_*hus的帖子

在bash中套管箭头键

如果按下向上/向左箭头键,是否可以在bash脚本中使用箭头键来运行某组命令,如果按下向下/向右箭头键,是否可以运行某个设置?我正试图通过使用箭头键在显示数据时快速切换用户,使用此脚本从中读取数据.

function main()  # The main function that controls the execution of all other functions
{
  mkdir -p ~/usertmp  # Make a new temporary user directory if it doesn't exist
  touch ~/last_seen_output.txt  # Create the output file if it doesn't exist
  cat /dev/null > ~/last_seen_output.txt  # Make sure that the output file is empty
  gather  # Call the "gather" function
  total=$((`wc -l ~/usertmp/user_list.txt|awk '{print $1}'`-1))  # Calculate the total amount of lines and subtract 1 from the result
  echo Current …
Run Code Online (Sandbox Code Playgroud)

bash

6
推荐指数
6
解决办法
2万
查看次数

标签 统计

bash ×1