From 49b7f1a7bc95ca6b0153e444b7ef320ebdf7e362 Mon Sep 17 00:00:00 2001 From: vindarel Date: Sat, 11 Mar 2023 15:23:23 +0100 Subject: [PATCH] scripts: allow scripts with or without a shebang line We strip the shebang line out, if there is one, so than the same .lisp file can be called with ciel -s .lisp or ./name --- scripting.lisp | 5 ++++- src/scripts/quicksearch.lisp | 2 +- src/scripts/simpleHTTPserver.lisp | 8 ++++---- 3 files changed, 9 insertions(+), 6 deletions(-) mode change 100644 => 100755 src/scripts/quicksearch.lisp diff --git a/scripting.lisp b/scripting.lisp index af6a6db..b466b2d 100644 --- a/scripting.lisp +++ b/scripting.lisp @@ -72,7 +72,10 @@ (format *error-output* "The script ~s was not found.~&" name)) (t ;; Run it! - (load (make-string-input-stream content)))))) + ;; Ignore the shebang line, if there is one. + ;; We can call scripts with ciel -s or with ./script + (load (maybe-ignore-shebang + (make-string-input-stream content))))))) (defun top-level/command () "Creates and returns the top-level command" diff --git a/src/scripts/quicksearch.lisp b/src/scripts/quicksearch.lisp old mode 100644 new mode 100755 index e44ec4a..ab12592 --- a/src/scripts/quicksearch.lisp +++ b/src/scripts/quicksearch.lisp @@ -3,7 +3,7 @@ ;;; ;;; ;;; Run with: -;;; $ ciel quicksearch keyword +;;; $ ciel -s quicksearch keyword ;;; ;;; or add a shebang line and make this script executable. ;;; diff --git a/src/scripts/simpleHTTPserver.lisp b/src/scripts/simpleHTTPserver.lisp index a5ce169..408b9ed 100755 --- a/src/scripts/simpleHTTPserver.lisp +++ b/src/scripts/simpleHTTPserver.lisp @@ -1,11 +1,11 @@ +#!/usr/bin/env ciel ;;; ;;; Run with: ;;; $ ciel -s simpleHTTPserver 4242 ;;; -;;; or add a shebang line and make this script executable: -;; #!/usr/bin/env ciel -;; => -;; $ ./simpleHTTPserver.lisp +;;; or +;;; +;;; $ ./simpleHTTPserver.lisp ;;; (in-package :ciel-user)