# portmaster .tcshrc alias



## pacija (Aug 13, 2012)

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:


```
sudo portversion -v | grep needs
```

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

Now, in portmaster(8) I see:


```
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.


----------



## johnd (Aug 13, 2012)

This is not directly what you asked for, but I use this:

```
portsnap fetch update && pkg_version -vIL=
```
Of course you can put this into an alias. IÂ´m calling it by using history substitution.


----------



## jrm@ (Aug 13, 2012)

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\<`


----------



## wblock@ (Aug 15, 2012)

pacija said:
			
		

> Now, in portmaster(8) I see:
> 
> 
> ```
> ...



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:

```
alias needs "portmaster -L |egrep -B1 '(ew|ort) version|Aborting|installed|dependencies|IGNORE|marked|Reason:|MOVED|deleted|exist|update' | grep -v '^--'"
```


----------



## pacija (Aug 16, 2012)

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...


----------



## wblock@ (Aug 16, 2012)

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.


----------

