06-07-2020
This commit is contained in:
@@ -283,41 +283,41 @@ test=$(find $dir -name "$name" -mmin -5 -maxdepth 1)
|
|||||||
Si les chaines sont <u>*identiques*</u> [ STRING1 == STRING2 ]
|
Si les chaines sont <u>*identiques*</u> [ STRING1 == STRING2 ]
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
if [ “$1” = “moo” ]; then
|
if [ "$1" = "moo" ]; then
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
if [[ “$1” == “moo” ]]; then
|
if [[ "$1" == "moo" ]]; then
|
||||||
```
|
```
|
||||||
|
|
||||||
Si les chaines sont <u>*différentes*</u> [ STRING1 != STRING2 ]
|
Si les chaines sont <u>*différentes*</u> [ STRING1 != STRING2 ]
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
if [ “$userinput” != “$password” ]; then
|
if [ "$userinput" != "$password" ]; then
|
||||||
```
|
```
|
||||||
|
|
||||||
Si la chaine 1 *<u>contient la sous-chaine</u>* chaine 2
|
Si la chaine 1 *<u>contient la sous-chaine</u>* chaine 2
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
if [ “$userinput” == *“$password”* ]; then
|
if [ "$userinput" == *"$password"* ]; then
|
||||||
if [ “$userinput” == “$password”* ]; then
|
if [ "$userinput" == "$password"* ]; then
|
||||||
if [ “$userinput” == *“$password” ]; then
|
if [ "$userinput" == *"$password" ]; then
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
if [ “$userinput” =~ .*$password.* ]; then
|
if [ "$userinput" =~ .*$password.* ]; then
|
||||||
```
|
```
|
||||||
|
|
||||||
Si la chaine 1 <u>*est triée après*</u> la chaine 2 [ STRING1 > STRING2 ]
|
Si la chaine 1 <u>*est triée après*</u> la chaine 2 [ STRING1 > STRING2 ]
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
if [ “$userinput” > “$password” ]; then
|
if [ "$userinput" > "$password" ]; then
|
||||||
```
|
```
|
||||||
|
|
||||||
Si la chaine 1 <u>*est triée avant*</u> la chaine 2 [ STRING1 < STRING2 ]
|
Si la chaine 1 <u>*est triée avant*</u> la chaine 2 [ STRING1 < STRING2 ]
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
if [ “$userinput” < “$password” ]; then
|
if [ "$userinput" < "$password" ]; then
|
||||||
```
|
```
|
||||||
|
|
||||||
Si la chaine <u>*NONEMPTYSTRING a une longueur > 0*</u> (contient 1 ou plusieurs caractères)
|
Si la chaine <u>*NONEMPTYSTRING a une longueur > 0*</u> (contient 1 ou plusieurs caractères)
|
||||||
@@ -325,7 +325,7 @@ Si la chaine <u>*NONEMPTYSTRING a une longueur > 0*</u> (contient 1 ou plusieurs
|
|||||||
```bash
|
```bash
|
||||||
if [ -n NONEMPTYSTRING ]; then
|
if [ -n NONEMPTYSTRING ]; then
|
||||||
|
|
||||||
if [ -n “$userinput” ]; then
|
if [ -n "$userinput" ]; then
|
||||||
```
|
```
|
||||||
|
|
||||||
Si la chaine <u>*EMPTYSTRING est vide*</u> (NULL)
|
Si la chaine <u>*EMPTYSTRING est vide*</u> (NULL)
|
||||||
@@ -339,7 +339,7 @@ if [ -z $uninitializedvar ]; then
|
|||||||
Si la chaine réussie la REGEX [[ STRING1 =~ REGEXPATTERN ]]
|
Si la chaine réussie la REGEX [[ STRING1 =~ REGEXPATTERN ]]
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
if [[ “$email” =~ “b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}b” ]]; then
|
if [[ "$email" =~ "b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}b" ]]; then
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -386,15 +386,15 @@ Exemples:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
if [ $? -eq 0 ]; then # $? returns the exit status of the previous command
|
if [ $? -eq 0 ]; then # $? returns the exit status of the previous command
|
||||||
echo “Previous command ran succesfully.”
|
echo "Previous command ran succesfully."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $(ps -p $pid -o ni=) -ne $(nice) ]; then
|
if [ $(ps -p $pid -o ni=) -ne $(nice) ]; then
|
||||||
echo “Process $pid is running with a non-default nice value”
|
echo "Process $pid is running with a non-default nice value"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $num -lt 0 ]; then
|
if [ $num -lt 0 ]; then
|
||||||
echo “Negative numbers not allowed; exiting…”
|
echo "Negative numbers not allowed; exiting…"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ grep -r "brew" ./docs/
|
|||||||
grep -l -r "brew" ./docs/
|
grep -l -r "brew" ./docs/
|
||||||
./docs//Divers/plex.md
|
./docs//Divers/plex.md
|
||||||
./docs//macos/node-js.md
|
./docs//macos/node-js.md
|
||||||
|
|
||||||
|
root@localhost:/etc# grep -r 'max_allowed_packet' ./mysql/
|
||||||
|
./mysql/conf.d/mysqldump.cnf:max_allowed_packet = 16M
|
||||||
|
./mysql/mariadb.conf.d/50-server.cnf:max_allowed_packet = 16M
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,12 @@ Pour éditer votre profile PowerShell, exécuter `notepad.exe $PROFILE`
|
|||||||
|
|
||||||
Editeur de scripts PowerShell: **Windows PowerShell ISE** (à ouvrir en administrateur).
|
Editeur de scripts PowerShell: **Windows PowerShell ISE** (à ouvrir en administrateur).
|
||||||
|
|
||||||
|
[Documentation](https://github.com/PowerShell/PowerShell/tree/master/docs)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- [Stratégies d'exécution PowerShell](ExecutionPolicies.md)
|
- [Stratégies d'exécution PowerShell](ExecutionPolicies.md)
|
||||||
- [Commandes](commands.md)
|
- [Commandes](commands.md)
|
||||||
- [Variables d'environnement](env.md)
|
- [Variables d'environnement](env.md)
|
||||||
|
- [PowerShell sur macOS](macOS.md)
|
||||||
|
|
||||||
|
|||||||
211
docs/Windows/PowerShell/macOS.md
Normal file
211
docs/Windows/PowerShell/macOS.md
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
# PowerShell sur macOS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cask install powershell
|
||||||
|
```
|
||||||
|
|
||||||
|
https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-macos?view=powershell-7
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Lancement:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pwsh
|
||||||
|
PowerShell 7.0.2
|
||||||
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
|
||||||
|
https://aka.ms/powershell
|
||||||
|
Type 'help' to get help.
|
||||||
|
|
||||||
|
PS /Users/bruno>
|
||||||
|
```
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
PS /Users/bruno> $psversiontable
|
||||||
|
|
||||||
|
Name Value
|
||||||
|
|
||||||
|
---- -----
|
||||||
|
|
||||||
|
PSVersion 7.0.2
|
||||||
|
PSEdition Core
|
||||||
|
GitCommitId 7.0.2
|
||||||
|
OS Darwin 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64
|
||||||
|
Platform Unix
|
||||||
|
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
|
||||||
|
PSRemotingProtocolVersion 2.3
|
||||||
|
SerializationVersion 1.1.0.1
|
||||||
|
WSManStackVersion 3.0
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Policy:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
PS /Users/bruno> Get-ExecutionPolicy -List | Format-Table -AutoSize Scope ExecutionPolicy
|
||||||
|
|
||||||
|
----- ---------------
|
||||||
|
|
||||||
|
MachinePolicy Unrestricted
|
||||||
|
UserPolicy Unrestricted
|
||||||
|
Process Unrestricted
|
||||||
|
CurrentUser Unrestricted
|
||||||
|
LocalMachine Unrestricted
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
#PS /Users/bruno> dir env:\
|
||||||
|
PS /Users/bruno> Get-ChildItem Env:
|
||||||
|
|
||||||
|
Name Value
|
||||||
|
|
||||||
|
---- -----
|
||||||
|
|
||||||
|
_ /usr/local/bin/pwsh
|
||||||
|
__CF_USER_TEXT_ENCODING 0x1F5:0x0:0x1
|
||||||
|
CMAKE_PREFIX_PATH /usr/local/Cellar/qt/5.14.1/lib/cmake/
|
||||||
|
COLORFGBG 15;0
|
||||||
|
COLORTERM truecolor
|
||||||
|
COMMAND_MODE unix2003
|
||||||
|
CONDA_CHANGEPS1 no
|
||||||
|
DISPLAY /private/tmp/com.apple.launchd.QNw7JYXSQU/org.macosforge.xquartz:0
|
||||||
|
EDITOR nano
|
||||||
|
ENABLE_PDF_EXPORT 0
|
||||||
|
GOPATH /Users/bruno/go
|
||||||
|
HOME /Users/bruno
|
||||||
|
HOMEBREW_NO_AUTO_UPDATE 1
|
||||||
|
ITERM_PROFILE lscolor
|
||||||
|
ITERM_SESSION_ID w0t3p0:6916F9BA-464C-4198-A7C2-5E2CBD028754
|
||||||
|
LANG fr_FR.UTF-8
|
||||||
|
LC_ALL en_US.UTF-8
|
||||||
|
LC_TERMINAL iTerm2
|
||||||
|
LC_TERMINAL_VERSION 3.3.11
|
||||||
|
LOGNAME bruno
|
||||||
|
LS_COLORS bd=38;5;68:ca=38;5;17:cd=38;5;113;1:di=38;5;30:do=38;5;127:ex=38;5;208;1:pi=38;5;126:fi=0:ln=target:mh=38;5;222;1:…
|
||||||
|
NVM_BIN /Users/bruno/.nvm/versions/node/v12.14.1/bin
|
||||||
|
NVM_CD_FLAGS -q
|
||||||
|
NVM_DIR /Users/bruno/.nvm
|
||||||
|
NVM_INC /Users/bruno/.nvm/versions/node/v12.14.1/include/node
|
||||||
|
OLDPWD /Users/bruno/.config/joplin
|
||||||
|
PATH /usr/local/microsoft/powershell/7:/Users/bruno/perl5/bin:/Users/bruno/.nvm/versions/node/v12.14.1/bin:/Users/bruno…
|
||||||
|
PERL_LOCAL_LIB_ROOT /Users/bruno/perl5
|
||||||
|
PERL_MB_OPT --install_base "/Users/bruno/perl5"
|
||||||
|
PERL_MM_OPT INSTALL_BASE=/Users/bruno/perl5
|
||||||
|
PERL5LIB /Users/bruno/perl5/lib/perl5
|
||||||
|
PROMPT_EOL_MARK
|
||||||
|
PSModulePath /Users/bruno/.local/share/powershell/Modules:/usr/local/share/powershell/Modules:/usr/local/microsoft/powershell/7…
|
||||||
|
PWD /Users/bruno
|
||||||
|
SHELL /bin/zsh
|
||||||
|
SHLVL 1
|
||||||
|
SSH_AUTH_SOCK /private/tmp/com.apple.launchd.1OMFyfGPss/Listeners
|
||||||
|
TERM xterm-256color
|
||||||
|
TERM_PROGRAM iTerm.app
|
||||||
|
TERM_PROGRAM_VERSION 3.3.11
|
||||||
|
TERM_SESSION_ID w0t3p0:6916F9BA-464C-4198-A7C2-5E2CBD028754
|
||||||
|
TMPDIR /var/folders/35/tdnmp_0n43nfmr32h7m2b8kw0000gn/T/
|
||||||
|
USER bruno
|
||||||
|
VIRTUAL_ENV_DISABLE_PROMPT 12
|
||||||
|
XPC_FLAGS 0x0
|
||||||
|
XPC_SERVICE_NAME 0
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### $PSHOME
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
PS /Users/bruno> $PSHOME
|
||||||
|
/usr/local/microsoft/powershell/7
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
PS /Users/bruno> $profile
|
||||||
|
/Users/bruno/.config/powershell/Microsoft.PowerShell_profile.ps1
|
||||||
|
```
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
PS /Users/bruno> $PROFILE | Get-Member -Type NoteProperty | Format-List
|
||||||
|
|
||||||
|
TypeName : System.String
|
||||||
|
Name : AllUsersAllHosts
|
||||||
|
MemberType : NoteProperty
|
||||||
|
Definition : string AllUsersAllHosts=/usr/local/microsoft/powershell/7/profile.ps1
|
||||||
|
|
||||||
|
TypeName : System.String
|
||||||
|
Name : AllUsersCurrentHost
|
||||||
|
MemberType : NoteProperty
|
||||||
|
Definition : string AllUsersCurrentHost=/usr/local/microsoft/powershell/7/Microsoft.PowerShell_profile.ps1
|
||||||
|
|
||||||
|
TypeName : System.String
|
||||||
|
Name : CurrentUserAllHosts
|
||||||
|
MemberType : NoteProperty
|
||||||
|
Definition : string CurrentUserAllHosts=/Users/bruno/.config/powershell/profile.ps1
|
||||||
|
|
||||||
|
TypeName : System.String
|
||||||
|
Name : CurrentUserCurrentHost
|
||||||
|
MemberType : NoteProperty
|
||||||
|
Definition : string CurrentUserCurrentHost=/Users/bruno/.config/powershell/Microsoft.PowerShell_profile.ps1
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### .NET Core:
|
||||||
|
|
||||||
|
[.NET Core (macOS)](https://dotnet.microsoft.com/download#macos)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ brew cask install dotnet-sdk
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ dotnet --info
|
||||||
|
.NET Core SDK (reflecting any global.json):
|
||||||
|
Version: 3.1.301
|
||||||
|
Commit: 7feb845744
|
||||||
|
|
||||||
|
Runtime Environment:
|
||||||
|
OS Name: Mac OS X
|
||||||
|
OS Version: 10.15
|
||||||
|
OS Platform: Darwin
|
||||||
|
RID: osx.10.15-x64
|
||||||
|
Base Path: /usr/local/share/dotnet/sdk/3.1.301/
|
||||||
|
|
||||||
|
Host (useful for support):
|
||||||
|
Version: 3.1.5
|
||||||
|
Commit: 65cd789777
|
||||||
|
|
||||||
|
.NET Core SDKs installed:
|
||||||
|
3.1.301 [/usr/local/share/dotnet/sdk]
|
||||||
|
|
||||||
|
.NET Core runtimes installed:
|
||||||
|
Microsoft.AspNetCore.App 3.1.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
|
||||||
|
Microsoft.NETCore.App 3.1.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
|
||||||
|
|
||||||
|
To install additional .NET Core runtimes or SDKs:
|
||||||
|
https://aka.ms/dotnet-download
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://wilsonmar.github.io/powershell-on-mac/
|
||||||
|
|
||||||
|
https://techcommunity.microsoft.com/t5/windows-powershell/how-to-use-powershell-as-an-admin-in-macos/m-p/364123
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://github.com/joonro/Get-ChildItemColor
|
||||||
|
|
||||||
179
docs/Windows/PowerShell/trucs.md
Normal file
179
docs/Windows/PowerShell/trucs.md
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
❯ 'Hello World' | Get-Member
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TypeName: System.String
|
||||||
|
|
||||||
|
Name MemberType Definition
|
||||||
|
|
||||||
|
---- ---------- ----------
|
||||||
|
|
||||||
|
Clone Method System.Object Clone(), System.Object ICloneable.Clone()
|
||||||
|
CompareTo Method int CompareTo(System.Object value), int CompareTo(string strB), int IComparable.CompareTo(System.Object obj), int IComparable[string].CompareTo(strin…
|
||||||
|
Contains Method bool Contains(string value), bool Contains(string value, System.StringComparison comparisonType), bool Contains(char value), bool Contains(char value…
|
||||||
|
CopyTo Method void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count)
|
||||||
|
EndsWith Method bool EndsWith(string value), bool EndsWith(string value, System.StringComparison comparisonType), bool EndsWith(string value, bool ignoreCase, cultur…
|
||||||
|
EnumerateRunes Method System.Text.StringRuneEnumerator EnumerateRunes()
|
||||||
|
Equals Method bool Equals(System.Object obj), bool Equals(string value), bool Equals(string value, System.StringComparison comparisonType), bool IEquatable[string]…
|
||||||
|
GetEnumerator Method System.CharEnumerator GetEnumerator(), System.Collections.IEnumerator IEnumerable.GetEnumerator(), System.Collections.Generic.IEnumerator[char] IEnum…
|
||||||
|
GetHashCode Method int GetHashCode(), int GetHashCode(System.StringComparison comparisonType)
|
||||||
|
GetPinnableReference Method System.Char&, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e GetPinnableReference()
|
||||||
|
GetType Method type GetType()
|
||||||
|
.../...
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
❯ 'Hello World'.ToLower()
|
||||||
|
hello world
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
❯ ping google.com
|
||||||
|
PING google.com (216.58.215.46): 56 data bytes
|
||||||
|
64 bytes from 216.58.215.46: icmp_seq=0 ttl=112 time=60.009 ms
|
||||||
|
64 bytes from 216.58.215.46: icmp_seq=1 ttl=112 time=156.384 ms
|
||||||
|
Request timeout for icmp_seq 2
|
||||||
|
64 bytes from 216.58.215.46: icmp_seq=3 ttl=112 time=131.664 ms
|
||||||
|
64 bytes from 216.58.215.46: icmp_seq=4 ttl=112 time=143.645 ms
|
||||||
|
64 bytes from 216.58.215.46: icmp_seq=5 ttl=112 time=77.214 ms
|
||||||
|
64 bytes from 216.58.215.46: icmp_seq=6 ttl=112 time=64.536 ms
|
||||||
|
64 bytes from 216.58.215.46: icmp_seq=7 ttl=112 time=64.478 ms
|
||||||
|
64 bytes from 216.58.215.46: icmp_seq=8 ttl=112 time=67.211 ms
|
||||||
|
64 bytes from 216.58.215.46: icmp_seq=9 ttl=112 time=62.654 ms
|
||||||
|
64 bytes from 216.58.215.46: icmp_seq=10 ttl=112 time=73.045 ms
|
||||||
|
^C
|
||||||
|
--- google.com ping statistics ---
|
||||||
|
11 packets transmitted, 10 packets received, 9.1% packet loss
|
||||||
|
round-trip min/avg/max/stddev = 60.009/90.084/156.384/35.969 ms
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
❯ Test-Connection google.com
|
||||||
|
|
||||||
|
|
||||||
|
Destination: google.com
|
||||||
|
|
||||||
|
Ping Source Address Latency BufferSize Status
|
||||||
|
(ms) (B)
|
||||||
|
|
||||||
|
---- ------ ------- ------- ---------- ------
|
||||||
|
|
||||||
|
1 SilverBook.local 216.58.215.46 77 32 Success
|
||||||
|
2 SilverBook.local 216.58.215.46 56 32 Success
|
||||||
|
3 SilverBook.local 216.58.215.46 75 32 Success
|
||||||
|
4 SilverBook.local 216.58.215.46 67 32 Success
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
❯ Get-Help Test-Connection
|
||||||
|
|
||||||
|
NAME
|
||||||
|
Test-Connection
|
||||||
|
|
||||||
|
SYNTAX
|
||||||
|
Test-Connection [-TargetName] <string[]> [-Ping] [-IPv4] [-IPv6] [-ResolveDestination] [-Source <string>] [-MaxHops <int>] [-Count <int>] [-Delay <int>] [-BufferSize <int>] [-DontFragment] [-TimeoutSeconds <int>] [-Quiet] [<CommonParameters>]
|
||||||
|
|
||||||
|
Test-Connection [-TargetName] <string[]> -Traceroute [-IPv4] [-IPv6] [-ResolveDestination] [-Source <string>] [-MaxHops <int>] [-TimeoutSeconds <int>] [-Quiet] [<CommonParameters>]
|
||||||
|
|
||||||
|
Test-Connection [-TargetName] <string[]> -MtuSize [-IPv4] [-IPv6] [-ResolveDestination] [-TimeoutSeconds <int>] [-Quiet] [<CommonParameters>]
|
||||||
|
|
||||||
|
Test-Connection [-TargetName] <string[]> -TcpPort <int> [-IPv4] [-IPv6] [-ResolveDestination] [-Source <string>] [-TimeoutSeconds <int>] [-Quiet] [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
❯ [System.Collections.ArrayList]$testArray = @()
|
||||||
|
|
||||||
|
❯ $testArray.Add('yahoo.com') | Out-Null
|
||||||
|
❯ $testArray.Add('google.com') | Out-Null
|
||||||
|
|
||||||
|
❯ $testArray
|
||||||
|
google.com
|
||||||
|
yahoo.com
|
||||||
|
|
||||||
|
❯ Test-Connection -ComputerName $testArray
|
||||||
|
|
||||||
|
|
||||||
|
Destination: google.com
|
||||||
|
|
||||||
|
Ping Source Address Latency BufferSize Status
|
||||||
|
(ms) (B)
|
||||||
|
---- ------ ------- ------- ---------- ------
|
||||||
|
1 SilverBook.local 172.217.18.206 3969 32 Success
|
||||||
|
2 SilverBook.local 172.217.18.206 60 32 Success
|
||||||
|
3 SilverBook.local 172.217.18.206 82 32 Success
|
||||||
|
4 SilverBook.local 172.217.18.206 62 32 Success
|
||||||
|
|
||||||
|
Destination: yahoo.com
|
||||||
|
|
||||||
|
Ping Source Address Latency BufferSize Status
|
||||||
|
(ms) (B)
|
||||||
|
---- ------ ------- ------- ---------- ------
|
||||||
|
1 SilverBook.local 98.138.219.231 2068 32 Success
|
||||||
|
2 SilverBook.local 98.138.219.231 208 32 Success
|
||||||
|
3 SilverBook.local 98.138.219.231 312 32 Success
|
||||||
|
4 SilverBook.local 98.138.219.231 204 32 Success
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Comparer 2 fichiers texte:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
❯ compare-object (get-content one.txt) (get-content two.txt)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Bash <-> PowerShell:
|
||||||
|
|
||||||
|
| Bash | PowerShell | Alias |
|
||||||
|
| ----------------------------- | ------------------------------------------------------------ | ---------------------- |
|
||||||
|
| pwd | Get-Location | pwd, gl |
|
||||||
|
| cd | Set-Location | cd, sl, chdir |
|
||||||
|
| ls | Get-ChildItem | ls, dir |
|
||||||
|
| ls -ltr | Get-ChildItem $env:USERPROFILE\Desktop \| Sort-Object -Property LastWriteTime | |
|
||||||
|
| find | Get-ChildItem | |
|
||||||
|
| find . -type f -iname "azure" | Get-ChildItem -Filter "\*azure\*" -Recurse -File | |
|
||||||
|
| cp | Copy-Item | cp, copy, cpi |
|
||||||
|
| cp -R Tools ~/ | Copy-Item -Path '.\Tools\' -Destination $env:USERPROFILE -Recurse | |
|
||||||
|
| | Copy-Item '.\Tools\' $env:USERPROFILE -Recurse | |
|
||||||
|
| rm | Remove-Item | rm, ri, rmdir, rd, del |
|
||||||
|
| rm -rf | Remove-Item -Recurse -Force | |
|
||||||
|
| mkdir | New-Item -ItemType Directory -Name 'MyNewFolder' | |
|
||||||
|
| touch | New-Item | |
|
||||||
|
| touch newFile{1..3} | 1..3 \| ForEach-Object { New-Item -ItemType File -Name "newFile$_" } | |
|
||||||
|
| cat | Get-Content | cat, gc, type |
|
||||||
|
| tail -n7 ./MyFile1 | Get-Content -Tail 7 .\MyFile1 | |
|
||||||
|
| tail -f ./log1 | Get-Content -Wait .\log1 | |
|
||||||
|
| uname -a | \$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture'<br /> Get-CimInstance Win32_OperatingSystem \| Select-Object $Properties \| Format-Table -AutoSize | |
|
||||||
|
| ping | Test-Connection | |
|
||||||
|
| | Test-Connection google.com \| Format-Table -AutoSize | |
|
||||||
|
| man | Get-Help | |
|
||||||
|
| | Get-Help Stop-Service -Full | |
|
||||||
|
| cut | Get-ChildItem $env:USERPROFILE\Desktop -Filter "*.ps1" \| >> Select-Object -Property 'Name', 'Length' | |
|
||||||
|
| | | |
|
||||||
|
| | | |
|
||||||
|
| | | |
|
||||||
|
| | | |
|
||||||
|
| | | |
|
||||||
|
| | | |
|
||||||
|
|
||||||
@@ -239,4 +239,4 @@ C:\Users\enzo2>wsl ls -la "/mnt/c/Program Files"
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
### =>[La suite (configurer wsl)](wsl2.md)<=
|
### =>[La suite (configurer wsl)](wsl_2.md)<=
|
||||||
@@ -46,6 +46,16 @@ $ httpd -v
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Modules activés:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ httpd -M
|
||||||
|
|
||||||
|
$ apachectl -M
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Configuration:
|
### Configuration:
|
||||||
|
|
||||||
Ouvrir le fichier *httpd.conf*:
|
Ouvrir le fichier *httpd.conf*:
|
||||||
|
|||||||
@@ -160,5 +160,7 @@ $ pip install --upgrade mkdocs-material
|
|||||||
|
|
||||||
[:octicons-link: MkDocs+](http://bwmarrin.github.io/MkDocsPlus/)
|
[:octicons-link: MkDocs+](http://bwmarrin.github.io/MkDocsPlus/)
|
||||||
|
|
||||||
|
https://github.com/otsuarez/mkdocs_auth
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user