terminal - Is it possible to write a bash script that changes the current directory to a random one? -


of course there little no point this, idea struck me today , haven't seen on it. suppose exercise on efficiency, if consider every directory under (/).

first idea comes mind:

pipe recursive ls command file, use wc count number of lines, generate random integer , use pick line file created.

ls -r / >> file_list.txt count=$(wc -l file_list.txt)

etc. can here.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -