0

Okay, this is a last attempt to see if I can salvage something I accidentally did.

I accidentally did "command > ~/.profile" instead of "command >> ~/.profile" on my computer.

I didn't have it version controlled (never happening again), and since the .profile wasn't open in an editor at the time, I don't have an existing version in any backup file or Vim buffer.

The only thing I can possibly think of at this point is that I still have a terminal session open running the lines that were in the ~/.profile file prior to my mistake above. My question is: Is there any way to get the currently executed source?

Maybe to be more explicit and generic, if I run

source ~/.profile

Is there any way to see what got executed in that terminal session outside of looking at the file that was sourced?

Lesson learned though, version ALL your dotfiles.

Thanks in advance.

-Hassan

2 Answers2

1

Not that i know of, but depending on what was in there, you can get a good portion of back in the terminal that is still open:

This will get your your prompt definition

$ echo $PS1

This will get you all of your shell variables and defined functions. it may be a LOT of stuff because, in Ubuntu for instance, there are all sorts of other macros for completion and whatnot defined, but you can extract what was yours.

$ set

This will give you your aliases

$ alias

These won't give you any logic that was in your .profile that helped decide how or why to define the things above, but they may get you much of what you need.

jerm
  • 637
  • 3
  • 5
0

You could try the history command in the session that ran the script to get a list of commands that have been recently executed.

Paccc
  • 166
  • 3
  • as far as I can see or tell; `history` doesn't track anything that was run during terminal session startup/initialization. Thanks for trying to help though. – Hassan Shahid Sep 18 '13 at 20:17