Why HOME paths are different

0

I have a script that updates GIT wc alone, by scheduled task in Windows. To do this, I use Cygwin by convenience. But I have a problem, because the ssh in Cygwin give this error:

percent_expand: unknown key %H

After some search, I found some answers saying this problem happens because of HOME variable. Well, when I start the CygWin by the shortcut in Desktop, this is the result

$ echo $HOME
/cygdrive/h/

When I do this executing the task in Task Scheduler the result is this:

$ echo $HOME
/usr/bin/%HOMEDRIVE%%HOMEPATH%

I don't know how to give the same value to both situations.

Vinicius Monteiro

Posted 2016-10-04T20:35:57.563

Reputation: 101

1Probably because you aren’t loading the (Cygwin) profile. – Daniel B – 2016-10-04T20:39:31.620

1the shortcut launch a login shell. From mintty manual "If a dash is given instead of a program, invoke the shell as a login shell." – matzeri – 2016-10-05T04:12:05.710

Answers

0

I found a way to fix this problem. After the comments of @DanielB and @matzeri, I started to search about the profile that is loaded by the shell.

So I found this page, talking about the profiles. Based on this documentation I edited the file C:\cygwin64\etc\skel\.inputrc uncommenting this lines:

$if Bash
  # Don't ring bell on completion
  #set bell-style none

  # or, don't beep at me - show me
  #set bell-style visible

  # Filename completion/expansion
  set completion-ignore-case on
  set show-all-if-ambiguous on

  # Expand homedir name
  set expand-tilde on #THIS LINE IS IMPORTANT

  # Append "/" to all dirnames
  #set mark-directories on
  #set mark-symlinked-directories on

  # Match all files
  set match-hidden-files on

  # 'Magic Space'
  # Insert a space character then performs
  # a history expansion in the line
  #Space: magic-space
$endif

Vinicius Monteiro

Posted 2016-10-04T20:35:57.563

Reputation: 101