Artificial intelligent assistant

Bash scrip passing argument in quotes i have command like this date -d @$(date -d 'Sat, 08 Aug 2020 00:00:00' "+%s") +'%Y-%m-%d' which output this 2020-08-08 So i want to use thins in bash scrip, i created this (this is just part of realy big script) Date1=$1 date -d @$(date -d $Date1 "+%s") +'%Y-%m-%d' But when i try to run like this ./test.sh "Sat, 08 Aug 2020 00:00:00" I get date: extra operand ‘Aug’ Try 'date --help' for more information. date: invalid date ‘@’ So its look like that "" desapear when passing argument

Wrap your `$Date1` inside the quotes and it should work:


date -d @$(date -d "$Date1" "+%s") +'%Y-%m-%d'


See also When is double-quoting necessary?

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy a7c0468845d6753d35a61df8d9170d0e