Guest User

Untitled

a guest
Jan 23rd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. udevadm info --query=all --name=/dev/sda | grep ID_SERIAL
  2.  
  3. public static string Bash(this string cmd)
  4. {
  5. var escapedArgs = cmd.Replace(""", "\"");
  6.  
  7. var process = new Process()
  8. {
  9. StartInfo = new ProcessStartInfo
  10. {
  11. FileName = "/bin/bash",
  12. Arguments = $"-c "{escapedArgs}"",
  13. RedirectStandardOutput = true,
  14. UseShellExecute = false,
  15. CreateNoWindow = true,
  16. }
  17. };
  18. process.Start();
  19. string result = process.StandardOutput.ReadToEnd();
  20. process.WaitForExit();
  21. return result;
  22. }
  23.  
  24. var output = "udevadm info --query=all --name=/dev/sda | grep ID_SERIAL".Bash();
Add Comment
Please, Sign In to add comment