Skip to content
/ os Public

Get information about the operating system in shell scripts

License

Notifications You must be signed in to change notification settings

importpw/os

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

os

Get information about the operating system in shell scripts.

API

os_platform

Prints the operating system platform as a lowercased string. Examples:

  • darwin
  • linux
  • windows
#!/usr/bin/env import
import "os"

os_platform
# linux

os_arch

Prints the CPU architecture that the operating system is running on. Examples:

  • x86
  • x86_64
#!/usr/bin/env import
import "os"

os_arch
# x86_64

os_path_unshift

Adds an entry to the beginning of the $PATH environment variable.

#!/usr/bin/env import
import "os"

echo "\$PATH before: $PATH"
os_path_unshift "/foo/bin"
echo "\$PATH after:  $PATH"

os_path_push

Adds an entry to the end of the $PATH environment variable.

#!/usr/bin/env import
import "os"

echo "\$PATH before: $PATH"
os_path_push "/foo/bin"
echo "\$PATH after:  $PATH"

About

Get information about the operating system in shell scripts

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages