Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: 'indent' for zsh files?
If you want to do it interactively you could write the script to a tempory file and then use emacs in batch-mode
#-------------------------------
prettify-script-filter() {
# first create a temporary file
local tmp_file
tmp_file=$(tempfile)
cat >! $tmp_file &&
emacs --batch $tmp_file \
-f shell-script-mode \
-f mark-whole-buffer \
-f indent-region \
-f save-buffer &&
cat $tmp_file
rm -rf $tmp_file
}
#-------------------------------
and then do something like
cat myscript.sh | prettify-script-filter
Martin
Messages sorted by:
Reverse Date,
Date,
Thread,
Author