Sunday, May 12, 2013

Cygwin notes

mount a windows directory: mount -o noacl -f "c:/Program Files" "/mount/programfiles"

Disable permission check when accessing Windows files:
  - Add the following line to /etc/fstab:  none /cygdrive cygdrive binary,posix=0,user,noacl 0 0 

Symbolic links:

A useful script:

#! /bin/bash

function conv() { 
  file="$1" 
  target="$(readlink $file)" 
  echo "file is $file; target is $target" 
  rm "$file" 
  #ln -s "$target" "$file" 
  # mkshortcut -n "$file" "$target" 
  winEscapedTarget="${target//\//\\}" #convert to windows path separator 
  winEscapedTarget="${winEscapedTarget//\\\\/\\}" #change \\ to \ 
  winEscapedFile="${file//\//\\}" #convert to windows path separator 
  winEscapedFile="${winEscapedFile//\\\\/\\}" #change \\ to \ 
  echo /cygdrive/c/Windows/System32/cmd.exe /c mklink "$winEscapedFile" "$winEscapedTarget" 
  /cygdrive/c/Windows/System32/cmd.exe /c mklink "$winEscapedFile" "$winEscapedTarget" 
  echo "re-link is done!" 
}

if [ $# -gt 0 ]; then 
  basedir="$1" 
  if [ -d "$basedir" ]; then 
    cd "$basedir" 
    if [ $? -ne 0 ]; then 
      echo "cannot cd to $basedir" 
      exit 1 
    fi 
  elif [ -f "$basedir" ]; then 
    cd "`dirname $basedir`" 
    file="`basename $basedir`" 
    echo "pwd is `pwd`" 
    conv "$file" 
    exit 0 
  else 
    echo "parameters are invalid" 
    exit 1 
  fi 
fi

1 comment:

Unknown said...


Thank you for sharing this knowledge in a blogpost
http://hadooptraininginhyderabad.co.in/