sawyl: (Default)
[personal profile] sawyl
Prompted by a couple of minor system irritations, I've spent a few odd moments this week brushing up my Expect and TCL skills in order to automate some tedious interactive tasks. And this has has led to a couple of minor revelations.

I've found that although TCL still isn't my favourite programming language, I've found myself disliking it less the more I use it and the more I come to grips with its quirks. Which is no bad thing, given that it is used by environment modules.

I've also realised that the main trick to writing robust Expect scripts is to expect shell prompts before and after each command. So before every command, it is worth sending a blank line to the child process and expecting a prompt to ensure that the previous command has completed successfully; and after each command, after expecting for a string that indicates whether the command has succeeded or failed, it is worth waiting for the child process to return a prompt in order to ensure that the most recent command really has finished.

I've also discovered that it is possible to reset user passwords on AIX without marking them as expired. This can be achieved by running the command pwdadm -c <user> against the account. The opposite, marking a password as expired without changing the user's password, can be achieved by running pwdadm -f ADMCHG <user>.

Although I'm not sure that I'll ever use Expect for much more than automating user account creations — not something that usually falls within my remit — it's still nice to be able to automate away at least some of the tedium.

Profile

sawyl: (Default)
sawyl

August 2018

S M T W T F S
   123 4
5 6 7 8910 11
12131415161718
192021222324 25
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Mar. 1st, 2026 06:45 pm
Powered by Dreamwidth Studios