Skip to content
Advertisement

Tag: shell

Bash: Using filenames as commands with the wildcard

I was playing around in my terminal earlier and discovered that I can execute single word commands (‘ls’,’cat’,’python2.7′,’exit’) by making a file or directory named the same thing as the command. However, I can’t execute ‘multi-word’ commands (‘rm -rf *’,’ls -a’, ‘python2.7 test.py’) (which also led me to discover that you can’t remove directories named ‘-rf’ with ‘rm -rf *’)

Why count differs between ls and ls -l linux command?

I had a directory with number of files and need to check the count of files present in it. I tried the following two commands: and found there are differences while using both commands. (ie. number of files is greater in the usage of second command while comparing to the first command.) I would like to know the changes happening

Pass argument to awk inside do loop

I have a large number of tab-separated text files containing a score I’m interested in in the second column: test_score_1.txt test_score_2.txt I want to check if I have Titles with a score smaller than a number I define. The following code defines my score in the script and works: check_score_1 If I try to pass an argument to awk like

Gnu sort: stray characters in field specification

sort doesn’t seem to like my key specification. Why? From the man page: -k, –key=KEYDEF : sort via a key; KEYDEF gives location and type KEYDEF is F[.C][OPTS][,F[.C][OPTS]] for start and stop position, where F is a field number and C a character position in the field; both are origin 1, and the stop position defaults to the line’s end.

Handling Dates in FTP

Here is my ftp script The output of this script is: I googled and seen some posts regarding dates but all provided formats not worked for me. Please advise Thanks in anticipation Answer through to FTP, which can include executing commands, substituting variables, and the like. That is to say, instead of writing: ftp < ftp_args> << EOT blah bloho

crontab shell script starts another script: remove char error

I want to run a shell script through crontab which does something and then runs another shell script which checks a certain folder for certain files and creates a directory for each file. The first script “my_crontab.sh” looks like this: Crontab executes “my_crontab.sh” and “start.sh” gets also called (I know from the crontab log file) This is what “start.sh” looks

Advertisement