transforms your source code/text into markdown-style blockquoted code
sov@sov-X550CC:~$ cat termination first line some text and more much more slow many lines termination sov@sov-X550CC:~$ cat one.txt first line of one.txt many other lines 1.txt many other1 lines 1.txt many other2 lines 1.txt last line of one.txt sov@sov-X550CC:~$ cat two.txt first line of two.txt many other lines 2.txt many other1 lines 2.txt many other2 lines 2.txt last line of two.txt sov@sov-X550CC:~$ cat three.txt first line of three.txt many other lines 3.txt many other1 lines 3.txt many other2 lines 3.txt last line of three.txt sov@sov-X550CC:~$ cat terminator.sh #!/bin/sh sed --in-place='bak.*' -e '1i \>```' -e 's/^/>/' -e '$a \>```' termination one.txt two.txt three.txt sov@sov-X550CC:~$ ./terminator.sh sov@sov-X550CC:~$ cat termination >``` >first line >some text and more >much more slow >many lines >termination >``` sov@sov-X550CC:~$ cat one.txt >``` >first line of one.txt >many other lines 1.txt >many other1 lines 1.txt >many other2 lines 1.txt >last line of one.txt >``` sov@sov-X550CC:~$ cat two.txt >``` >first line of two.txt >many other lines 2.txt >many other1 lines 2.txt >many other2 lines 2.txt >last line of two.txt >``` sov@sov-X550CC:~$ cat three.txt >``` >first line of three.txt >many other lines 3.txt >many other1 lines 3.txt >many other2 lines 3.txt >last line of three.txt >``` sov@sov-X550CC:~$
- there were issues with copied output in Part 1 —something [firefox, a clipboard and so on] had eaten whitespaces i guess; but because i lose my memory oftenly i cannot tell that was not my issue —when i myself have copied that line from this my github readme.md in Android a couple of days ago it has not produced correct markdown output [certainly]1
- here is a code snippet from Lesson 1 written cleanly:
#!/bin/sh sed --in-place='.bak' -e '1i \> ```' -e 's/^/> /' -e '$a \> ```' termination echo "Asta la Vista!"
- #please note that in Unix systems all your source codes are expected to terminate with a newline character! [e.g. android eats last string in terminal emulators]
- i have tried passing file name to command line script in Android but it DOES NOT WORK!
- there were
'$1'
and/proc/self/fd/1
and maybestdin
and even more [i have lost my memory after exiting thedothe
]
- i use following tools in my Android systems:
- airTerm2
- simpleBusyBox v.3 (busybox v1.24.2)3
- total commander4
- SD Maid5
- QuickEdit6
- jbak2 keyboard7 with my own layout which you may find in another my repository here @gitHub8
- #please note that my two file managers have different sets of features —e.g. tc cannot install apk files while SD Maid is quiet reckless (specifically with deleting images —Gallery shows broken links after removals)
- set execute permissions with a file manager if your Android is rooted
- it is impossible to directly execute custom scripts in non‑rooted system [because changing execute [and any other] permissions is blocked]
- use this workaround:
sh ./terminator.sh
terminator () { sed -e '1i \> ```' -e 's/^/> /' -e '$a \> ```' }
- it can be used together with
cat
but it would be usable ONLY FOR SMALL FILES because [at least my] Android’s terminal emulators do not allow SCROLLING WHILE COPYING!!!
bash
script variant is already posted above- here is that
sh
function
terminator () { sed --in-place='.bak' -e '1i \> ```' -e 's/^/> /' -e '$a \> ```' termination }
export PATH=/data/local/bin:$PATH export PATH=/data/data/org.galexander.busybox/files:$PATH cd /storage/emulated/0/Workplace terminator () { sed --in-place='.bak' -e '1i \> ```' -e 's/^/> /' -e '$a \> ```' termination; } echo "Hello, hacker!!!"
- it is called
initial command
in terminal emulators’ preferences - rename your source code or text to
termination
then to invoke the script simply issueterminator
command - then you would may need to rename other your files to
termination
after copying processed content of your source - there is backup [unprocessed] copy left behind —
termination.bak
[it would be overwritten @ next invocation of the script]
Footnotes
-
several days after i have written this note i have found that github DOES work with BOTH 'spaced'
> ```
and 'solid'>```
forms of my script’s output —but 'solid' form is displayed as broken until parced by an engine probably [anyhow it is very upsetting considering i have typical karhidish temperament] ↩ -
https://play.google.com/store/apps/details?id=com.myboyfriendisageek.airterm [i have found that most other terminal emulators are broken down to unusability; even this one does not allow multisessions hanging Android system (is valid at least for Jelly Bean); oh ...i just have found it may not be used with Kit Kat (implications are really serious and my smartphone is even lagging now —AFTER an uninstall)] ↩
-
https://play.google.com/store/apps/details?id=org.galexander.busybox ↩
-
https://play.google.com/store/apps/details?id=eu.thedarken.sdm ↩
-
https://play.google.com/store/apps/details?id=com.ghisler.android.TotalCommander ↩
-
https://play.google.com/store/apps/details?id=com.rhmsoft.edit ↩
-
https://play.google.com/store/apps/details?id=com.jbak2.JbakKeyboard ↩
-
https://github.com/irulanCorrino/kturtle-script-keyboard-layout-for-jbak2 ↩