A
A
alex5e2015-03-10 20:43:29
linux
alex5e, 2015-03-10 20:43:29

How to display the shortest environment variable in the terminal?

Good evening. Can you tell me how to display the shortest environment variable in the terminal?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Shetani, 2015-03-10
@alex5e

In what sense is it short, title or content?
You can sort like this

env | awk '{print length, $0}' | sort -n | awk '{$1=""; print $0 }'

S
ShamblerR, 2015-03-10
@ShamblerR

print the list of variables starting from 1 character, then filter by 1 character, if the next output is empty then give 2 characters each and so on until any character appears on the output.
But the profit is really doubtful, can you give an example of a real benefit?
with the same success it is possible to derive variables that look "indecent" or the name offends the feelings of believers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question