- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: variable in if
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
тАО04-15-2008 01:59 PM
тАО04-15-2008 01:59 PM
Re: variable in if
it was very closed to what I had, but I placed my quote place wrong.
thanks for your help!
ps: you also dont need the ":=", you only need "="
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2008 02:59 PM
тАО04-15-2008 02:59 PM
Re: variable in if
I too had concocted a solution identical to by Dennis'. It would seem to be correct (using '=' instead of the ALGOL assignment ':=' operator) and yet failed/fails for me:
# [ -z "${LIST=$(ls -1 /tmp/gemini* 2>/dev/null})" ] && echo "empty" || echo ${LIST}
This does not yield any results for me; rather it gives and empty list. Comments, gentlemen?
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2008 03:20 PM
тАО04-15-2008 03:20 PM
Re: variable in if
I corrected in my script, but I didnt point it out.
this should be right.
[ -z "${LIST=$(ls -1 /tmp/gemini* 2>/dev/null)}" ] && echo "empty" || echo ${LIST}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2008 03:26 PM - edited тАО09-16-2011 07:03 PM
тАО04-15-2008 03:26 PM - edited тАО09-16-2011 07:03 PM
Re: variable in if
I made a typo, swap the "}" and ")":
[ -z "${LIST:=$(ls -1 /tmp/gemini* 2>/dev/null)}" ]
>you also don't need the ":=", you only need "="
Yes, only because $LIST must NOT be set at all.
>JRF: This does not yield any results for me; rather it gives and empty list. Comments, gentlemen?
Did you do this as root? You have created a file in /dev: null}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-15-2008 03:42 PM
тАО04-15-2008 03:42 PM
Re: variable in if
Aahhaa! Yes, OK.
> Dennis: I made a typo, swap the "}" and ")":
Oh, OK, I kept missing that :-{
> Dennis: Did you do this as root? You have created a file in /dev: null}
And, again, yes! I did and I had a file in '/dev/' so named.
Very nice solution, Dennis.
Regards!
...JRF...
- « Previous
-
- 1
- 2
- Next »