2

I would like to create multiple empty files using tcsh, similar to the command:

touch {0..999}.txt

no bash installed.

%echo $SHELL

%/bin/tcsh

If possible, not using script but a terminal command

2 Answers 2

2

You can use seq's formatting option and avoid the loop by passing multiple args to touch:

touch `seq -f %.0f.txt 1 999`
Sign up to request clarification or add additional context in comments.

Comments

1

I've just created a simple script that does it:

file name: script

\#!/bin/tcsh

set j = 1
while ($j <= 10000)
     touch $j.txt
     @ j++ 
end

changed the permissions for the script to +x :

chmod +x script

and executed :

./script

2 Comments

Can you please expalin why you consider this approach better than alias script "touch 'seq -f %.0f.txt 1 999'"
I was looking for any solution. didn't really consider one over the other

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.