Issue
I have a bash file that is pretty long, and I don't want to spend hours painstakingly going through and making it a one liner. Is there some online tool or command I can use to make my file into a one liner?
I already tried looking for beautifiers and formatters, but none do what I need it to, and I even searched on here for about an hour and all I could find was stuff about how to make a one liner not how to convert my entire file into a one liner.
Solution
This is a horrible idea. Do not do it.
That said, if you define the following function:
onelineify() {
script_content=$(gzip -9 <"$1" | base64 -w0)
printf '%s\n' '#!/usr/bin/env bash'
printf 'eval "$(base64 -d <<<%q | gunzip -c)"\n' "$script_content"
}
onelineify yourscript
will write a version of your script that is only one line (beyond the shebang) to stdout.
Answered By - Charles Duffy Answer Checked By - Mildred Charles (WPSolving Admin)