Quantcast
Channel: dir command: force output to one filename per line, full path included, but nothing else - Ask Ubuntu
Viewing all articles
Browse latest Browse all 5

Answer by JayCravens for dir command: force output to one filename per line, full path included, but nothing else

$
0
0

It's a bit messy, but I got it in one line:

readarray <<< $(dir -1) dir_list; for line in "${dir_list[@]}"; do printf "%s\n" "$line"; done | xargs -I {} echo "$PWD/{}"

It separates each dir -1 into individual "line"s, then iterates the array, appending the echo of $PWD to each xargs line.


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>