Search code examples
bashshelluser-interfaceunixmanpage

Shell script UI


Is there a way to display a simple text based UI via shell scripting that isn't interspersed with the prompts & etc in the main bash process? Essentially I want something that acts like man, only it displays something that isn't a manpage and waits for a user input to get back to whatever the bash process was displaying. Is there a way to do this just using an existing shell command or should I be doing this portion with a compiled language?

I know how I can get the user input and print stuff, but I'm unsure how to display said separate ui like man is doing.


Solution

  • Perhaps less would be of use to you for this:

    #!/bin/sh
    
    displayfile="/etc/fstab"
    
    printf "continuing with script 1\n"
    
    sleep 1
    
    less "$displayfile"
    
    printf "continuing with script 2\n"
    
    printf "continuing with script 3\n"