portmaster .tcshrc alias

Reading around that portmaster(8) is the way to go, I am trying to do the switch from portupgrade(8). I got used to the command:

Code:
sudo portversion -v | grep needs

to check which ports need updating after running portsnap fetch update.

Now, in portmaster(8) I see:

Code:
     Print only the ports that have available updates.  This can be used as an
     alias in your shell.  Be sure to fix the line wrapping appropriately.
           portmaster -L |
           egrep -B1 '(ew|ort) version|Aborting|installed|dependencies|
           IGNORE|marked|Reason:|MOVED|deleted|exist|update' | grep -v '^--'

but I do not know how to fix line wrapping and how to properly escape quotes, pipes etc. in my .tcshrc file. I would be grateful if someone who created this alias in tcshrc pasted me the line that works.
 
This is not directly what you asked for, but I use this:
Code:
portsnap fetch update && pkg_version -vIL=
Of course you can put this into an alias. I´m calling it by using history substitution.
 
I think you meant portsnap and not portmaster. So here is the command.

# portsnap fetch update && pkg_version -IvL=

With pkgng you can use something like the following.

# portsnap fetch update && pkg version -Ivl\<
 
pacija said:
Now, in portmaster(8) I see:

Code:
     Print only the ports that have available updates.  This can be used as an
     alias in your shell.  Be sure to fix the line wrapping appropriately.
           portmaster -L |
           egrep -B1 '(ew|ort) version|Aborting|installed|dependencies|
           IGNORE|marked|Reason:|MOVED|deleted|exist|update' | grep -v '^--'

but I do not know how to fix line wrapping and how to properly escape quotes, pipes etc. in my .tcshrc file. I would be grateful if someone who created this alias in tcshrc pasted me the line that works.

Generally, it's preferred that posters show what they have tried. In this case, just add an alias line in .cshrc. See tcsh(1) for the format; it is the word alias followed the name and the command, all separated by whitespace. The command should be surrounded by quotes if it contains spaces. In this case:
Code:
alias needs "portmaster -L |egrep -B1 '(ew|ort) version|Aborting|installed|dependencies|IGNORE|marked|Reason:|MOVED|deleted|exist|update' | grep -v '^--'"
 
Thank you wblock@,

sometimes the solution is too easy we oversee it :)

I tried without the double quotes at first which of course did not work, and then jumped into various combinations of quoting, triple-escaping and similar which even more of course did not work :)

Now, I will not dare to ask how to break the line...
 
Line continuation backslashes seem to work. Aliases are a little weird, and there could be special cases. An alias that becomes too long can be converted into a shell script.
 
Back
Top