rolfbruge
May 30th, 2024, 09:43 PM
I ran this simple bash script through shellcheck.net and no errors but does not function.
The objective is to read downloaded *.deb packages stored within the directory into an array and install each element of the array with dpkg:
running the ls line lists the pacakages, but output is "no such file or directory" or "permission denied" even though cli is executed using sudo.
#!/bin/bash
FILES=$( ls "/home/linuxuser/pkgs" )
for element in "${FILES[@]}"
do
sudo dpkg -i "$element"
done
Being relatively new to this issue can someone give me specific pointers?
The objective is to read downloaded *.deb packages stored within the directory into an array and install each element of the array with dpkg:
running the ls line lists the pacakages, but output is "no such file or directory" or "permission denied" even though cli is executed using sudo.
#!/bin/bash
FILES=$( ls "/home/linuxuser/pkgs" )
for element in "${FILES[@]}"
do
sudo dpkg -i "$element"
done
Being relatively new to this issue can someone give me specific pointers?