Skip to content

Tag: bash

Linux shell script, differences between two directories

I made this code I want to compare two folders and the folder are arguments to the command line.. it should be something like this : ./script.sh dir1 dir2 But i have this eror : **./director.sh: line 29: `$1′: not a valid identifier ** I want to count the file from dir1 who is argument to the command li…

time option doesn’t work

I tried to measure execution time and format it with this command: But such command works: I tried to determine where another time is located, but all showes to /usr/bin/time or or How to define where another time is located? Answer Users of the bash shell need to use an explicit path in order to run the exte…

Using awk to trim away parts of a text file outside 2 patterns

I’d like an elegant awk solution to edit the lines in a file. So far I’ve only managed to complete the task using 2 sed commands and 1 awk command. Each file is composed of a header of indeterminate length, followed by the data I want to capture, then a footer which always starts with the same str…

Using shell commands with boot2docker

I have created a boot2docker VirtualBox instance, I can SSH into it OK but then when I try and run any commands such as bash I get Pretty sure I’m missing something really simple but can’t see what. Looking in /bin it doesn’t look to contain bash I’m pretty new to the *nix world so be …

Using bc as daemon in BASH shell from awk

In BASH environment I can communicate with bc program using fifo. But in awk I can write but no read with getline function. How can I read from “/dev/fd/4” in awk. My awk version is: mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan Thanks Laci Continued: I did some further experiment and I su…

Remove Files older than 3 years

I need to remove any file in the directory that is older than 2 years old. It is very important that I keep the newest files and delete the old files. I have searched and found this. Can I just multiply the number? Is there a way to add a switch that will print the file name to the screen