Stop being the product.
Become the owner.
or
sign uplog in

Web Automation with Selenium In Bash: you need to use…

Web Automation with Selenium
In Bash: you need to use Python to control Brave with Selenium.

Example:
`python3 -c "from selenium import webdriver; from selenium.webdriver.chrome.options import Options; opt=Options(); opt.binary_location='/usr/bin/brave-browser'; driver=webdriver.Chrome(options=opt); driver.get('https://example.com')"`

→ This is long and not very readable.

In PowerShell: the syntax is simpler and more direct.

``` Example:
`$option = New-Object OpenQA.Selenium.Chrome.ChromeOptions `
`$option.BinaryLocation = "/usr/bin/brave-browser"`
`$driver = New-Object OpenQA.Selenium.Chrome.ChromeDriver($option )`
`$driver.Navigate().GoToUrl("https://example.com")`

→ Same result, but clearer and without complicated dependencies.
Multimedia processing with ffmpeg
In Bash: extract audio from a video:
`ffmpeg -i video.mp4 -vn -acodec mp3 audio.mp3`

In PowerShell: the command is the same, but you can chain it with other actions using the pipeline:
`ffmpeg -i video.mp4 -vn -acodec mp3 audio.mp3`
`Get-ChildItem *.mp3 |` ForEach-Object { $_.Name }

→ PowerShell allows you to manage files directly after the command.
Text manipulation and randomization
In Bash: you need to combine several tools (tr, xargs, head, shuf).

Example:
`cat texte.log | tr ' ' '\n' | xargs -n5 | head -n 678 > sortie_1.txt`
`shuf texte.log > fichier_random.log`

In PowerShell: it's more readable and integrated.

Example:
`Get-Content texte.log | ForEach-Object {
($_ -split ' ')[0..4] -join ' '
} | Select-Object -First 678 | Set-Content sortie_1.txt`

`Get-Content texte.log | Get-Random -Count (Get-Content texte.log).Count |` Set-Content random_log_file

→ PowerShell simplifies logic thanks to its built-in commands.
Simplified summary
Bash: powerful but often requires several small tools combined.
PowerShell: clearer, more readable, and directly integrates advanced functions.
Basically, PowerShell is better suited to beginners because it avoids complex combinations and remains closer to a programming language.
earnings
32,000 mlx total
$0  total
engagement
58 views
0 reactions

0 comments