Slayer0248
Slayer0248

Reputation: 1261

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.

Upvotes: 1

Views: 410

Answers (2)

user4832408
user4832408

Reputation:

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"

Upvotes: 0

choroba
choroba

Reputation: 241928

See dialog, kdialog, zenity, and similar.

man can use any pager configured, the default today is usually less.

Upvotes: 2

Related Questions