Search Results

Search: Posts Made By: phorgan1
23,647
Posted By phorgan1
Follow up to the $@ vs $* conundrum
So following up, this script:

#!/bin/bash
export IFS="
"
echo "$@"
echo "$*"
for arg in $@ ; do
echo $arg
done
for arg in $* ; do
echo $arg
done
for arg in "$@" ; do
echo...
23,647
Posted By phorgan1
Thanks, and maybe you can clear this up.
This is cool! I'm sure I have something to learn here, because I had thought that outside of double quotes, $@ and $* were identical. Quoting from the Bash Reference Manual:

So, please, I've...
23,647
Posted By phorgan1
Just the thing! Thank you! This lets me do it...
Just the thing! Thank you! This lets me do it more simply, and lets me collect args for the ls so that for example, sometimes I could do lsd, sometimes lsd -a. I've decided to build an arg string...
196,895
Posted By phorgan1
One thing that eval does that is critical is...
One thing that eval does that is critical is break things apart in strings. For example if in a script you wrote lscommand="ls -F", then tried to run $lscommand, the shell would give you an amusing...
23,647
Posted By phorgan1
That's it exactly. ls does more flexible...
That's it exactly. ls does more flexible formatting, giving more columns with shorter filenames. If there was a pr -auto that worked liked that it would be cool:)

Patrick
23,647
Posted By phorgan1
Oh! I get the ./ behavior
If the only directory is ./ then the pipeline has no output, and the default directory for ls with no arguments is ./ -- so -- accidentally I got behavior I want. I'd still like to have a shorter...
23,647
Posted By phorgan1
pipe to ls with filenames with spaces breaks!
I wanted an alias or program, lsd, that would show just the directories in a directory. My first take was this alias.

alias lsd='ls -d `find . -maxdepth 1 -type d -print | grep -v "^.$" | cut -c...
Showing results 1 to 7 of 7

 
All times are GMT -4. The time now is 05:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy