A
A
Anton2015-09-15 21:10:26
linux
Anton, 2015-09-15 21:10:26

How to remember the first value of the 'find' command?

I execute the command:
find $SOURCE_DIR -type f -name '*.txt' -mtime -1
In a certain variable, you need to save the first value issued by the 'find' command. Tell.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2015-09-15
@jimmyjonezz

cut through head
$myvar=`find $SOURCE_DIR -type f -name '*.txt' -mtime -1 | head -n 1`

A
abcd0x00, 2015-10-01
@abcd0x00

[[email protected] ~]$ f=`find -type f -print -quit`
[[email protected] ~]$ echo $f
./tmp/.swp
[[email protected] ~]$

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question