I open multiple shell tabs when I start KDE, and I've just added keychain to my ~/.shellrc the problem is that all the tabs prompt for key passwords when I login. This is quite annoying to do this. Is there any good solution for this so that all the tabs simply start, and once I've logged into one tab, all of them have the keys loaded?
How can I run keychain in a way that only has the first shell prompt for keys on startup?
shell;security
Here are two methods:You can ensure that keychain only opens on one tab like this:if mkdir /tmp/keychain.lock; then  eval `keychain --eval --agents ssh id_dsa`  rm -r /tmp/keychain.lockfiBut it may not be on the first tab you land on - you might have to hunt for it, which could be just as annoying. This works because mkdir is an atomic operation - only one script will succeed, and that one will display the prompt.Another way will display the prompt on all the tabs, but will quit them once you respond on any one of them. You can poll a file or use inotify-tools like this:file=/tmp/keychain-waittouch $fileinotifywait -e delete_self $file |\while read file event; do  if [ $event = DELETE_SELF ]; then   pkill keychain fidone &keychainrm $fileThis one presents the prompt, but first it starts a watcher to see if a file is deleted. After the prompt is satisfied, the file is deleted, and the watcher will kill any other prompts that are waiting. inotifywait is from inotify-tools; inotify is a Linux API. There may be a similar API on other Unices, but if not, you only need a loop that polls to see if the file is deleted.