1
smbclient //10.10.101.29/it -W WORKGROUP -U user --password pass -c 'put ./file_$(date +%Y_%m_%d).file ./folder/file_$(date +%Y_%m_%d).file'

The above does not work & gives me an error stating: ./file_$(date does not exist

I have tried variables:

date=$(date +%Y_%m_%d)

This results in the same behavior, but instead I get the following message: ./file$_{date}.file does not exist

Is it not possible to use the variables from the Ubuntu shell in the smb command or smb subshell? Are there any alternatives?

1 Answer 1

1

It should work with double quotes like

smbclient //10.10.101.29/it -W WORKGROUP -U user --password pass -c "put file_$(date +%Y_%m_%d).file"

or

date=$(date +%Y_%m_%d)
smbclient //10.10.101.29/it -W WORKGROUP -U user --password pass -c "put file_${date}.file"
1
  • That got it!. If I had enough reputation, my upvote for you would show. Thanks for the help - I really appreciate it! Commented May 21, 2019 at 20:09

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.