sudo apt-get install chromium-browser --yesOperates similarly to Chrome, but feels a bit faster, particularly on a Raspberry Pi.
sudo apt-get install chromium-browser --yes
PS /home/david> Test-Path $PROFILE
False
PS /home/david> New-Item -Path $PROFILE -Type File -Force
Directory: /home/david/.config/powershell
Mode LastWriteTime Length Name
---- ------------- ------ ----
------ 3/29/19 10:26 AM 0 Microsoft.PowerShell_profile.ps1
PS /home/david> $PROFILE
/home/david/.config/powershell/Microsoft.PowerShell_profile.ps1
PS /home/david> Set-Content -Path $PROFILE -Value '$Host.UI.RawUI.WindowTitle = "Powershell"'
PS /home/david> Get-Content $PROFILE
$Host.UI.RawUI.WindowTitle = "Powershell"
PS /home/david> .$PROFILE
function Rename-Shell{
param([string]$Name)
$Host.UI.RawUI.WindowTitle = $Name
}
PS /home/david> .$PROFILE
PS /home/david> Rename-Shell -Name 'My Terminal'
david@mint ~ $ powershell
PowerShell 6.1.3
https://aka.ms/pscore6-docs
Type 'help' to get help.
PS /home/david> Get-Location
Error reading or writing history file '/home/david/.local/share/powershell/PSReadLine/ConsoleHost_history.txt': Access to the path '/home/david/.local/share/powershell/PSReadLine/ConsoleHost_history.txt' is denied.
ưm
Path
----
/home/david
david@mint ~ $ ls -l /home/david/.local/share/powershell/PSReadLine/ConsoleHost_history.txt
-rw-r--r-- 1 root root 336 Mar 28 11:04 /home/david/.local/share/powershell/PSReadLine/ConsoleHost_history.txt
david@mint ~ $ sudo chown david /home/david/.local/share/powershell/PSReadLine/ConsoleHost_history.txt
[sudo] password for david:
david@mint ~ $ sudo chgrp david /home/david/.local/share/powershell/PSReadLine/ConsoleHost_history.txt
david@mint ~ $ ls -l /home/david/.local/share/powershell/PSReadLine/ConsoleHost_history.txt
-rw-r--r-- 1 david david 336 Mar 28 11:04 /home/david/.local/share/powershell/PSReadLine/ConsoleHost_history.txt
david@mint ~ $ powershell
PowerShell 6.1.3
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/pscore6-docs
Type 'help' to get help.
PS /home/david> Get-Location
Path
----
/home/david
PS /home/david> Get-History
Id CommandLine
-- -----------
1 Get-Location
#!/bin/sh
echo "Hello, World!"
chmod +x example.sh
#!/usr/bin/env python
print("Hello, World!")
#!/usr/bin/perl -w
print "Hello, World!\n"
$ which powershell
/snap/bin/powershell
#!/usr/bin/env powershell
Write-Host "Hello, World!"
$ ./example.ps1
Hello, World!
PS A:\> $MyData = Get-Content $TempCsv | ConvertFrom-Csv | ConvertTo-Json PS A:\> $MyJson = $MyData | ConvertFrom-Json PS A:\> $MyJson name twitter url ---- ------- --- David dbsteimle rhymeswithtimely.blogspot.com Commander Candy codingComander codingcommanders.com
PS A:\> $MyJson | ConvertTo-Html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>HTML TABLE</title> </head><body> <table> <colgroup><col/><col/><col/></colgroup> <tr><th>name</th><th>twitter</th><th>url</th></tr> <tr><td>David</td><td>dbsteimle</td><td>rhymeswithtimely.blogspot.com</td></tr> <tr><td>Commander Candy</td><td>codingComander</td><td>codingcommanders.com</td></tr> </table> </body></html>
| name | url | |
|---|---|---|
| David | dbsteimle | rhymeswithtimely.blogspot.com |
| Commander Candy | codingComander | codingcommanders.com |
PS A:\> $OutPut = $null
PS A:\> $Output += "<table>`n<tr>`n<th>Name</th>`n<th>Twitter</th>`n<th>URL</th>`n</tr>`n"
PS A:\>
PS A:\> foreach($Record in $MyJson){
>> $OutPut += "<tr>`n"
>> $OutPut += "<th>$($Record.name)</th>`n"
>> $Output += "<td><a href='https://twitter.com/$($Record.twitter)'>@$($Record.twitter)</a></td>`n"
>> $Output += "<td><a href='http://$($Record.url)'>$($Record.url)</a></td>`n"
>> $OutPut += "</tr>`n"
>> }
PS A:\> $OutPut += "</table>"
PS A:\> $OutPut
<table>
<tr>
<th>Name</th>
<th>Twitter</th>
<th>URL</th>
</tr>
<tr>
<th>David</th>
<th><a href='https://twitter.com/dbsteimle'>@dbsteimle</a></th>
<th><a href='http://rhymeswithtimely.blogspot.com'>rhymeswithtimely.blogspot.com</a></th>
</tr>
<tr>
<th>Commander Candy</th>
<th><a href='https://twitter.com/codingComander'>@codingComander</a></th>
<th><a href='http://codingcommanders.com'>codingcommanders.com</a></th>
</tr>
</table>
$Record has properties we want to reference withing a string, we need to isolate it, as in $($Record.name) to allow the .name to parse properly.| Name | URL | |
|---|---|---|
| David | @dbsteimle | rhymeswithtimely.blogspot.com |
| Commander Candy | @codingComander | codingcommanders.com |
PS A:\> $Example = @"
>> localpath,registry,share,text
>> C:\Temp,HKLM:\SOFTWARE,\\thatshare\me,use a`ttab
>> "@
PS A:\> $Example
localpath,registry,share,text
C:\Temp,HKLM:\SOFTWARE,\\thatshare\me,use a tab
PS A:\> $Example | ConvertFrom-Csv | ConvertTo-Json
{
"localpath": "C:\\Temp",
"registry": "HKLM:\\SOFTWARE",
"share": "\\\\thatshare\\me",
"text": "use a\ttab"
}
PS A:\> sqlite3 .\example.db
SQLite version 3.24.0 2018-06-04 19:24:41
Enter ".help" for usage hints.
sqlite> .mode line
sqlite> SELECT * FROM example;
name = David
twitter = dbsteimle
url = rhymeswithtimely.blogspot.com
name = Commander Candy
twitter = codingComander
url = codingcommanders.com
sqlite> .quit
[System.IO.Path]::GetTempFileName(). To use that file, you want to assign it to a variable.PS A:\> $TempCsv = [System.IO.Path]::GetTempFileName() PS A:\> $TempCsv C:/Users/david/AppData/Local/Temp/tmp47AD.tmp
PS A:\> $TempCsv = $TempCsv.Replace("\","/")
PS A:\> $TempCsv
C:/Users/david/AppData/Local/Temp/tmp47AD.tmp
PS A:\> $TempSql = @" >> .headers on >> .mode csv >> .output $TempCsv >> SELECT name, >> twitter, >> url >> FROM example; >> .quit >> "@ PS A:\> $TempSql .headers on .mode csv .output C:/Users/david/AppData/Local/Temp/tmp47AD.tmp SELECT name, twitter, url FROM example; .quit
PS A:\> $TempSql | sqlite3 .\example.db
PS A:\> gc $TempCsv name,twitter,url David,dbsteimle,rhymeswithtimely.blogspot.com "Commander Candy",codingComander,codingcommanders.com
PS A:\> Get-Content $TempCsv | ConvertFrom-Csv | ConvertTo-Json
[
{
"name": "David",
"twitter": "dbsteimle",
"url": "rhymeswithtimely.blogspot.com"
},
{
"name": "Commander Candy",
"twitter": "codingComander",
"url": "codingcommanders.com"
}
]
sudo apt update
sudo apt install snapd
sudo snap install powershell --classic
/snap/bin to your pathdavid@mybox ~ $ sudo which pwsh /snap/bin/pwsh david@mybox ~ $ PATH=$PATH:/snap/bin
Distributor ID: LinuxMint
Description: Linux Mint 18.3 Sylvia
Release: 18.3
Codename: sylvia
Name Value
---- -----
PSVersion 6.1.3
PSEdition Core
GitCommitId 6.1.3
OS Linux 4.15.0-46-generic #49~16.04.1-Ubuntu SMP Tue Feb 12 17:45:24 UTC 2019
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0