Hot answers tagged

3

Your script has a few issues: The error stems from the export line. You are using $SERVER as a command, and this command can not be found. What you'd like to do is to feed the string into cut: print $SERVER | cut -c1-2,5-10 | ... The line SERVER="echo `hostname`" is better written SERVER=$(hostname) The tr utility takes character ranges, so there's ...


2

Assuming your files have sane names (i.e. they don't have embedded newlines), something like this should work: find . -mtime +60 | fgrep -v -x -f exceptions.txt | xargs -d '\n' rm -f Replace rm -f with ls -1 for a dry run first. Put paths exactly as they are printed by find in exceptions.txt.


2

Turns out it is documented behaviour. From the ksh93 man page: Search Edit Commands These commands access your command history. [count]k Fetch previous command. Each time k is entered the previous command back in time is accessed. [count]- Equivalent to k. [count][A If cursor is at the end of the line it is equivalent to / ...


2

I would use paste here. It's a nifty tool that can be used to combine files: $ paste printdirs.txt archivedirs.txt /u/lawson/law/print/lawson/tim/1 /u/lawson/law/print/archive /u/lawson/law/print/dgfinance/monday190/1 /u/lawson/law/print/archive2 As you can see above, it will print successive lines from both files, separated by tabs. The tab-...


2

By default if you just set PS1="...." then the stuff inside the quotes is evaluated at the time you set it. However if you enclose it inside ' instead then it's evaluated at display time. And it doesn't cause a subshell for $(jobs). e.g. $ PS1=' > $(jobs) > $ ' $ sleep 1000 & [1] 7541 [1] + Running sleep 1000 & $ sleep ...


2

Most tutorials you can find are about bash. Ksh is very good at scripting but is bad at interactive use. Use zsh (best) or bash (second-best) as a command line if you can. There are two main implementations of ksh today: the actual Korn shell ksh93, and the clone mksh (derived from the long-unmaintained pdksh). They have different key binding facilities. ...


1

My actual problem was that (in contrast to the simplified example in my question), I actually massaged the jobs output in a function, separating running from stopped jobs. This is my code for Bash: typeset runningJobs=$(jobs -r | wc -l) typeset stoppedJobs=$(jobs -s | wc -l) which I ported to Korn shell in this way: typeset runningJobs=$(jobs | grep -c '...


1

Just run your whole install script under setarch $ setarch $(uname -m) --uname-2.6 /path/to/install/script.sh Everything called in that script onwards will think you're running a 2.6 kernel.


1

I don't think find has an option like this, you could build a command using printf and your exclude list: find . -name "*.txt" $(printf "! -name %s " $(cat file.txt)) -mtime +60 -exec rm -f {} + file.txt will have list of files to exclude in find command.



Only top voted, non community-wiki answers of a minimum length are eligible