You are not logged in.

#1 2022-11-23 14:50:35

Nick_Name
Member
Registered: 2022-11-07
Posts: 18

[SOLVED] Some troubles with aliases

Hello!
Can you help me with one question?
Why command:

pacman -Qi | awk '/^Name/{name=$3}/^Installed Size/{print $4$5, name}' | sort -h

perfectly works in term, but in alias gives syntax error:

awk: cmd. line:1: /^Name/{name=}/^Installed Size/{print , name}
awk: cmd. line:1:              ^ syntax error

?

alias:
alias wpac=" pacman -Qi | awk '/^Name/{name=$3} /^Installed Size/{print $4$5, name}' | sort -h
kernel:
6.0.9-arch1-1
term:
alacritty 0.11.0 (8dbaa0bb)
shell:
fish 3.5.1-1

Thank you!

Last edited by Nick_Name (2022-11-23 15:30:45)

Offline

#2 2022-11-23 15:24:10

seth
Member
Registered: 2012-09-03
Posts: 51,019

Re: [SOLVED] Some troubles with aliases

The shell tries to interpret $3, $4 & $5
https://www.chiark.greenend.org.uk/~sgt … iases.html

alias wpac=" LC_ALL=C pacman -Qi | awk '/^Name/{name=\$3} /^Installed Size/{print \$4\$5, name}' | sort -h"

(also notice the closing double quote)

Online

#3 2022-11-23 15:30:15

Nick_Name
Member
Registered: 2022-11-07
Posts: 18

Re: [SOLVED] Some troubles with aliases

seth wrote:

The shell tries to interpret $3, $4 & $5
https://www.chiark.greenend.org.uk/~sgt … iases.html

alias wpac=" LC_ALL=C pacman -Qi | awk '/^Name/{name=\$3} /^Installed Size/{print \$4\$5, name}' | sort -h"

(also notice the closing double quote)

It works!
Thank you very much

Offline

Board footer

Powered by FluxBB