Linux File Systems: please write down a pseudo code that implements shell command “find . -name myfile -print”.
Psuedo Code :
$ # Let's make some test files $ mkdir ASCII-finder $ cd ASCII-finder $ dd if=/dev/urandom of=binary.file bs=1M count=1 1+0 records in 1+0 records out 1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.009023 s, 116 MB/s $ file binary.file binary.file: data $ echo 123 > text.txt $ # Let the magic begin $ find -myfile-print0 | \ xargs -0 -I @@ bash -c 'file "$@" | grep ASCII &>/dev/null && echo "file is ASCII: $@"' -- @@
Get Answers For Free
Most questions answered within 1 hours.