- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Checking for file type
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2005 09:42 AM
тАО02-03-2005 09:42 AM
I am using a change management system that makes available a variable called $vcsfile (this is the name of the file(s) being moved from location to location) and $vcsfile_suffix (this the file extension of the file(s) being moved from location to location).
I am struggling with how to construct the logic to execute one command versus another based on the file extension.
For example:
if $vcsfile_suffix = .qks
then
qd $vcsfile
if $vcsfile_suffix = .cob
then
sc_cobcomp $vcsfile
...
fi
I see the commands but not exactly sure how to string them all together for it to work ...
Thanks in advance for any help.
Jeff
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2005 09:48 AM
тАО02-03-2005 09:48 AM
Re: Checking for file type
then
qd $vcsfile
if [ "$vcsfile_suffix" = ".cob"
then
sc_cobcomp $vcsfile
...
fi
Note on getting the filessuffix.
Lets say the names are all two part:
something.qks
something.cob
extention = $(ls $filename | awk -F. '{print $2}')
vcsfile_suffix=$extension}
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2005 09:49 AM
- Tags:
- case
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2005 08:52 PM
тАО02-03-2005 08:52 PM
Re: Checking for file type
but if you do decide to go with "if", don't forget the "else"!
e.g.
#!/bin/ksh
if [[ $vcsfile_suffix = ".qks" ]]
then
qd $vcsfile
else
if [[ $vcsfile_suffix = ".cob" ]]
then
sc_cobcomp $vcsfile
...
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2005 09:00 PM
тАО02-03-2005 09:00 PM
Re: Checking for file type
not sure this adds anything to the "case" solution but:
basename
will get you the suffix of filename ;-)
Regards
- Tags:
- basename