0

Note

I know how to run a simple command inside another command, but in my case is special.

My command contain ". (date "+%Y-%m-%d")

Goal

I need to display my log via 1 command

Steps

If I do this date "+%Y-%m-%d" I will get 2020-06-03

I want to pass that command into another command like this :

tail -f /Users/jdoe/Sites/laravel7/storage/logs/laravel-"date "+%Y-%m-%d"".log

I can't to get it working.

How do I do it ?

Expected

To run this command

tail -f /Users/jdoe/Sites/laravel7/storage/logs/laravel-2020-06-03.log
2

This is called command substitution

tail -f /Users/jdoe/Sites/laravel7/storage/logs/laravel-$(date "+%Y-%m-%d").log

An older deprecated syntax uses backticks

tail -f /Users/jdoe/Sites/laravel7/storage/logs/laravel-`date "+%Y-%m-%d"`.log

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.