Reputation: 517
I have a command I want to run first I ran another command to get a directory which is saved in a variable:
path_white="/sys/block/sdb"
Then I want to run another command using this variable and store the output in a variable. I get errors and don't know what I am doing wrong. Any help will be appreciated.
path_pci_white=$(ll $path_white | xargs | cut -d / -f 8 | cut -b 6-13)
it seems that it is not running the entire command below is the error
/sys/block/sdb : is a directory
when i run
ll /sys/block/sdb | xargs | cut -d / -f 8 | cut -b 6-13
in the terminal i get what i want output I just want to use a variable and put the output into a variable
Thanks
Upvotes: 0
Views: 418
Reputation: 361615
ll
is an alias for ls -l
, and aliases aren't defined in shell scripts. Use an explicit ls -l
instead.
Upvotes: 2
Reputation: 249153
There should not be a pipe after xargs. xargs takes as arguments the command it will run. Otherwise there is no point to it.
Upvotes: 1