[SOLVED] Reading two variables in a character string with "/" as field separator
SlackwareThis Forum is for the discussion of Slackware Linux.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
most of these will fail if there are more than one '/' (eg /usr/share/xfce/xfwm4-theme-axe)
they all work admirably if you can guarantee only one.
Off the cuff, I'm not quite sure how to handle multiple ones - unless you just want the 'dirname' and 'basename' and are not worried about 'dirname' being a full pathname containing slashes ... or you could progressively use dirname until it return just a '.' ...
Off the cuff, I'm not quite sure how to handle multiple ones
Given the usage shown by kiki if there was more to it then it would be a path with the package last and the category second last. This is a simple one that can be dealt with by using reverse then cutting it after the second delimiter and reversing it again.
EDIT In the interests of insane bash scripts here is one of mine :