0

I want to know what the -fix--missing argument does in the command below

For example:

man apt-get update -fix--missing

Now if i type the command as it is above, it will be the same thing as typing man apt-get. Then i have to type /-fix--missing while I'm in the man page and hit enter to jump to -fix--missing

Is there any faster way where i can just type one command and directly from the terminal and jump to the -fix--missing section of the man page? or is this not possible.

muru
  • 72,889
avg9957
  • 195
  • Or https://unix.stackexchange.com/questions/302740/query-linux-man-page-for-certain-flag – muru Sep 08 '20 at 05:47
  • Don't forget https://unix.stackexchange.com/q/96095/5132 , https://unix.stackexchange.com/q/18087/5132 , and https://unix.stackexchange.com/q/477084/5132 . (-: – JdeBP Sep 08 '20 at 08:58

1 Answers1

0

You might abuse the LESS variable, assuming that you are using less as a pager. You can use this as the basis of your own function or script.

# sman, optionally search a man page.
sman(){
  case $# in
   (0|1) exec man "$@" ;;   
   (*) eval LASTARG="\$$#" ; exec LESS="-p$LASTARG" man "$1" ;;
  esac
}

If you pass it more than one argument it will use the final one as a pattern to search for. For this to be a serious command it should at least parse the options being passed.

icarus
  • 17,920