Quote:
Originally Posted by
MartyIX
Era:
> The Powershell developers have the luxury of a clean slate and a knowledge of history
The whole discussion is about if to renew unix tools or not. And I know it's a courageous question from a man who learns it a few months but I think the question is relevant with the arrival of Windows PowerShell.
Ok, back to your original question then:
Quote:
1. Aren't options of unix commands too much confusing?
Personally, no. I guess to be confused, I'd have to have expectations that they were common across the board. Since I don't have that assumption, if it's something new I'll check the man page for a description and which options I want to use.
Quote:
Why are not standardized in a way that it's "easy" to guess what option one need. It seems to me that unix scripting is a thing where you can "enjoy yourself" but you have to be still worried about type of distribution and so on - isn't it actually drawback?
I think this has been answered a couple of times at the utility and command line switch level. In general I expect there'll be a few differences. Heck, korn shell doesn't work exactly the same between Solaris and HP-UX. I write scripts for the OS I'm most comfortable with and adjust as I get to other systems. Eventually I'm aware of the gotcha's between systems and compensate for it in my scripts with:
if [[ $OS = "SunOS" ]]
then
...
fi
I'm not writing full fledged applications. Just scripts to check for things. Logs are located in different places on systems so I have to have a OS check to see if messages is in /var/adm, /var/log, or /var/cluster/members/member2
If it's a larger script, I'll use perl which is the same across platforms and has the tools within it to mirror what the utilities do.
Quote:
Perderabo:
> Is Powershell really worth learning?
I don't think it's time to say there's Windows PowerShell Comunity Technology Preview 2 and the tool is developing. But for my purposes it's quite good.
That's great for you. As I'm a Unix admin, I have five flavors of Unix at work and four at home not including the Cygwin installations. I have cygwin on my Windows boxes so I have similar commands across all the systems I manage.
Quote:
a few examples:
# Finding files greater than 10MB
$files=get-childitem d:\ -recurse -force
$files | Where {$_.length -gt 10MB} | Sort Length -descending | tee-object D:\tmp\report.txt
# find / -size 10000000c -exec ls -l {} \; | sort -k2 -n | tee /tmp/report.txt
It probably can be better but that's off the top of my head.
Quote:
# Copying files with preserving tree structure
copy -path e:\html -filter *.htm -dest D:\Temp\Project -recurse -container -passthru
# cd /html; tar cf - *.htm | (cd /temp/project; tar fx -)
Quote:
Examples are silly but it's a tool that I've always missed in Windows. (the syntax is quite interesting)
From an advantage point of view, it's there on all the Unix platforms I manage. While the command may differ from place to place, I know the command is still "find" and not "get-childitem". If it doesn't work exactly as expected, I can refer to the man page and find the odd option.
The disadvantage is what you observed. You may have to do some searching when you go to a different system.
The disadvantage for me of learning Powershell is that it's only on Windows systems and I haven't managed Windows systems since NT 3.51. If it comes over to a Unix platform, I might take a look.
Carl