Skip to main content
edited body
Source Link
frabjous
  • 9.2k
  • 1
  • 38
  • 34

This will basically accomplish it. What's really happening is that the command line prompt is just a fake one, but whatever you enter it executes right away, so it might as well be a real command prompt.

func() {
    cd scripts
    read -e -p '$ ' -i './excellent/script' command
    execeval $command
}

If your prompt is more complicated than $ , to make it look right, you might need to remove -p '$ ' and add a line echo -ne "[whatever] " or similar before the read line.

This will basically accomplish it. What's really happening is that the command line prompt is just a fake one, but whatever you enter it executes right away, so it might as well be a real command prompt.

func() {
    cd scripts
    read -e -p '$ ' -i './excellent/script' command
    exec $command
}

If your prompt is more complicated than $ , to make it look right, you might need to remove -p '$ ' and add a line echo -ne "[whatever] " or similar before the read line.

This will basically accomplish it. What's really happening is that the command line prompt is just a fake one, but whatever you enter it executes right away, so it might as well be a real command prompt.

func() {
    cd scripts
    read -e -p '$ ' -i './excellent/script' command
    eval $command
}

If your prompt is more complicated than $ , to make it look right, you might need to remove -p '$ ' and add a line echo -ne "[whatever] " or similar before the read line.

deleted 2 characters in body
Source Link
frabjous
  • 9.2k
  • 1
  • 38
  • 34

This will basically accomplish it. What's really happening is that the command line prompt is just a fake one, but whatever you enter it executes right away, so it might as well be a real command prompt.

func() {
    cd scripts
    read -e -p '$ ' -i './excellent/script' command
    exec "$command"$command
}

If your prompt is more complicated than $ , to make it look right, you might need to remove -p '$ ' and add a line echo -ne "[whatever] " or similar before the read line.

This will basically accomplish it. What's really happening is that the command line prompt is just a fake one, but whatever you enter it executes right away, so it might as well be a real command prompt.

func() {
    cd scripts
    read -e -p '$ ' -i './excellent/script' command
    exec "$command"
}

If your prompt is more complicated than $ , to make it look right, you might need to remove -p '$ ' and add a line echo -ne "[whatever] " or similar before the read line.

This will basically accomplish it. What's really happening is that the command line prompt is just a fake one, but whatever you enter it executes right away, so it might as well be a real command prompt.

func() {
    cd scripts
    read -e -p '$ ' -i './excellent/script' command
    exec $command
}

If your prompt is more complicated than $ , to make it look right, you might need to remove -p '$ ' and add a line echo -ne "[whatever] " or similar before the read line.

Source Link
frabjous
  • 9.2k
  • 1
  • 38
  • 34

This will basically accomplish it. What's really happening is that the command line prompt is just a fake one, but whatever you enter it executes right away, so it might as well be a real command prompt.

func() {
    cd scripts
    read -e -p '$ ' -i './excellent/script' command
    exec "$command"
}

If your prompt is more complicated than $ , to make it look right, you might need to remove -p '$ ' and add a line echo -ne "[whatever] " or similar before the read line.