|
@@ -194,6 +194,26 @@ fixnl() {
|
194
|
194
|
rm "$cache"
|
195
|
195
|
}
|
196
|
196
|
|
|
197
|
+nlfor() {
|
|
198
|
+ #
|
|
199
|
+ # Replace $1 with newlines and fix final newline
|
|
200
|
+ #
|
|
201
|
+ # Shorthand for commonly used tr syntax. Example:
|
|
202
|
+ #
|
|
203
|
+ # $ echo "$PATH" | nlat :
|
|
204
|
+ # /foo
|
|
205
|
+ # /bar
|
|
206
|
+ # $
|
|
207
|
+ #
|
|
208
|
+ # is almost like `tr -n :` except that it is a bit easier
|
|
209
|
+ # to type and fixes the annoying problem with missing
|
|
210
|
+ # newline at the end of the replaced string.
|
|
211
|
+ #
|
|
212
|
+ local char=$1
|
|
213
|
+ tr "$char" '\n' \
|
|
214
|
+ | fixnl
|
|
215
|
+}
|
|
216
|
+
|
197
|
217
|
xop() {
|
198
|
218
|
#
|
199
|
219
|
# Common clipboard operations with fixnl() on top
|