String Expansion (Curly Braces)

  • Build a series of string arguments, iterating over characters inside curly braces:
    string{A,B,C} = stringA stringB stringC
  • Example: creating name of nonexistent file (wildcards can't do this):
    % mv file{1,2}.html
    mv file1.html file2.html
    % cp file.html{,.bak}
    cp file.html file.html.bak
  • Not just for filenames!
    % mail {joe,jan,steve} < file
    mail < file
    % scp{X,23,bar}.c .
    scp .
< previous  index  next >

Contact Jerry Peek