This code shows nothing(if date.txt does exist):
date > date.txt | cut < date.txt --delimiter ' ' --fields 1
Questions:
[apologies for grammar and terminology mistakes, and
date |tee date.txt | cut --delimiter ' ' --fields 1
works, it is known.
]
Commands in a pipeline are executed concurrently. So when you write
date > date.txt | cut --delimiter '' --fields 1 < date.txt
cut
might try to read from the file before date
has written to it, and there's nothing to read. There's no need for a pipeline if you're using a file for communication, just write the commands sequentially.
date > date.txt
cut --delimiter '' --fields 1 < date.txt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.