Quantcast
Channel: Oracle Bloggers
Viewing all articles
Browse latest Browse all 19780

Cygwin or Powershell

$
0
0

Among those command line workers on Windows, I think Cygwin bash has greater share over Powershell.
I'm one of those and here is my Powershell one-liner I invoke often in bash.

$ powershell -command 'Get-Service' | grep Oracle
Stopped  OATSHelperSvr      Oracle Application Testing Suite He...
Stopped  Oracle Applicat... Oracle Application Testing Suite Ap...
Stopped  OracleASMServic... OracleASMService+ASM

As you can see Powershell is too conservative here and truncates 2 columns too short.


But .. OK. Powershell can do something more intelligent.

$powershell -command 'Get-Service | Format-Table -AutoSize' | grep Oracle
Stopped OracleASMService+ASM                                 OracleASMServic...
Stopped OracleDBConsoleorcl                                  OracleDBConsole...
Stopped OracleJobSchedulerORCL                               OracleJobSchedu...

Now, Powershell is too tolerant for 2nd column and thus truncates 3rd column too short.
Unfortunately, there seems to be no workaround for mintty which is a default Cygwin tty application.


Now, if you want to do something in the middle, you can give powershell cryptic options.

$powershell -command 'Get-Service|Format-Table -Property @{Width=7;Align="Left";Expression="Status"},@{Width=32;Expression="Name"},DisplayName' | grep Oracle
Stopped OracleASMService+ASM             OracleASMService+ASM
Stopped OracleVssWriterORCL              Oracle ORCL VSS Writer Service

One needs to use names in 2nd column for command like sc.exe.
As you can see above, for some Oracle Windows service, "Name"(2nd column) and "DisplayName"(3rd) differ.
So, this is something to be aware of if you use sc.exe.
Maybe sc.exe is obsolete but my finger remembers it.






Viewing all articles
Browse latest Browse all 19780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>