This is the development version of Kanrisuru. Since this is still a pre-1.0 release, we don't recommend using this in system-critical production environments.

Kanrisuru

readlink

Print value of a symbolic link or canonical file name in ruby
linux manual

Basic Usage

require 'kanrisuru'
host = Kanrisuru::Remote::Host.new(host: '127.0.1.1', username: 'ubuntu', keys: ['~/.ssh/id_rsa'])

result = host.readlink('/etc/os-release')
result.success? 
true

result.path
'/usr/lib/os-release'

Parameters

Field Type Description
path string
Required name of program to get full path of
canonicalize boolean
Canonicalize by following every symlink in every component of the given name recursively; all but the last component must exist
canonicalize_existing boolean
Canonicalize by following every symlink in every component of the given name recursively, all components must exist
canonicalize_missing boolean
Canonicalize by following every symlink in every component of the given name recursively, without requirements on components existence

Result

Returns an array of FilePath structs.

FilePath Fields

Field Type Description
path string Symbolic or absolute file path

Return Example

host.readlink('/etc/os-release', canonicalize: true).data
#<Struct:Kanrisuru::Core::Path::FilePath:0x00000640
  path = "/usr/lib/os-release"
>

Exit Status

Code Description
0 Success
1 Failure

Tested On

  • Ubuntu, Debian, Centos, Fedora, Redhat, OpenSuse, SLES