RSS flow:

Swap - Reverse two file names


    Sometimes having to reverse two file names. To do this, it is possible to add a function to the shell. This function is called swap.


    To use Swap:
      swap file1 file2
    The content of file2 will be on file1, and vice versa.


      To do this, simply place the lines:
        	function swap()         # swap 2 filenames around
        		local TMPFILE=tmp.$$
        		mv "$1" $TMPFILE
        		mv "$2" "$1"
        		mv $TMPFILE "$2"
      on ~/.bashrc file.


      Go back