Probably obvious but just in case I'll mention that you can also use $HOME
instead of ~.


On Wed, Sep 26, 2018 at 2:43 PM Kurtis Rader <kra...@skepticism.us> wrote:

> On Wed, Sep 26, 2018 at 1:43 PM John Chludzinski <
> john.chludzin...@gmail.com> wrote:
>
>> I tried to use ~ in a path and got this:
>>
>> sudo dd if=~/Downloads/SSS/sss_image-20180817.img of=/dev/sdb bs=1048576
>>
>> dd: failed to open '~/Downloads/SSS/sss_image-20180817.img': No such
>> file or directory
>>
>
> That is the expected behavior. From the documentation:
>
> Home directory expansion
>> The ~ (tilde) character at the beginning of a parameter, followed by a
>> username, is expanded into the home directory of the specified user. A lone
>> ~, or a ~followed by a slash, is expanded into the home directory of the
>> process owner.
>
>
> This is also how it works in shells like ksh and bash. The shell has no
> way of knowing that the string following "if=" is a path. You can use a var
> to do it:
>
> set x ~/Downloads/...
> sudo dd if=$x ...
>
> --
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
> _______________________________________________
> Fish-users mailing list
> Fish-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fish-users
>
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to