Hi there, new to unix and all that using solaris 2.8 bash.
I constantly have to vi the last file in a large list of log files following ls -rt. This means highlighting and pasting the selection what a pain. I've tried to put together a script that will find the pwd, run ls -rt | tail -1 and then pass this onto the vi command to open the file automatically.
I was going to alias this to something like 'alias lf="ksh lastfile.ksh"'
My problem at the moment is that I can't seem to find a way to return the result of ls -rt | tail -1 to a variable that I can pass to vi command within the file.
In fact I want to pass the value of pwd to a variable in order to cd to the current directory in order to perform the ls -rt | tail -1.
How do you go about doing this
Any ideas on this one.
cheers
simmo
I constantly have to vi the last file in a large list of log files following ls -rt. This means highlighting and pasting the selection what a pain. I've tried to put together a script that will find the pwd, run ls -rt | tail -1 and then pass this onto the vi command to open the file automatically.
I was going to alias this to something like 'alias lf="ksh lastfile.ksh"'
My problem at the moment is that I can't seem to find a way to return the result of ls -rt | tail -1 to a variable that I can pass to vi command within the file.
In fact I want to pass the value of pwd to a variable in order to cd to the current directory in order to perform the ls -rt | tail -1.
How do you go about doing this
Any ideas on this one.
cheers
simmo