Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: script mode #41

Closed
polarhive opened this issue Jul 12, 2024 · 1 comment · Fixed by #63
Closed

feat: script mode #41

polarhive opened this issue Jul 12, 2024 · 1 comment · Fixed by #63
Labels
enhancement New feature or request
Milestone

Comments

@polarhive
Copy link
Collaborator

Parse and run .sh scripts.

@polarhive polarhive added the enhancement New feature or request label Jul 12, 2024
@polarhive polarhive added this to the week-3 milestone Jul 16, 2024
@polarhive
Copy link
Collaborator Author

polarhive commented Jul 16, 2024

Proof of Concept:

This is a quick and dirty Implementation of .sh file mode, when commands are sequential and do not rely on pipes.

  1. Write a script (ex: script.sh) in a text editor and set executable permissions:
nvim script.sh
chmod +x script.sh
  1. Identify the lines you want to combine. For example:
#!/path/to/psh
echo "hi this is some text on line 1"
echo "line 2"
ls
  1. Combine commands using semicolons: ;
echo "hi this is some text on line 1"; echo "line 2"; ls

This executes all commands sequentially in a single line.

  1. Run the script:
./script.sh
# or 
psh ./script.sh

Ensure

  • The psh binary is invoked correctly if using #!/path/to/psh
  • Or execute the script directly with psh ./script.sh
  • Each line in script.sh is transformed into a buffer with terminating ;
  • Input this buffer into stdin, simulating manual keyboard input

@polarhive polarhive linked a pull request Jul 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant