## bash startup variable expression

I have the idea that I would like to add an environment variable (“waitTillReady”) to my ~/.bashrc file, such that instead of doing this:

while [ "$(pidof -s make)" -o "$ (pidof -s gcc)" -o "$(pidof -s ld)" ]; do echo "Still compiling..." && sleep 1; done && printf "\n%.0s" {1..20} && date && echo "THINGS ARE READY FOR YOU NOW..." I want to be able to do this: $ waitTillReady && echo "THINGS ARE READY FOR YOU NOW..."

I tried to edit my ~/.bashrc file like with different combinations of the following:

## Closed form expression for $Tr\left[ (\mathbf{DW})^k \right]$

Given the $$N \times N$$ diagonal matrices $$\mathbf{D}$$ and $$\mathbf{W}$$ as defined below

$$$$\begin{split} \mathbf{DW} &= \frac{1}{{M N}} \left[ \begin{array}{cccc} \beta_{1} & 0 & \cdots & 0 \ 0 & \beta_{2} & \cdots & 0\ \vdots & \vdots & \ddots & \vdots \ 0 & 0 & \cdots & \beta_{N} \ \end{array} \right] % \left[ \begin{array}{cccc} M & \sum_{m=0}^{M-1}{\mbox{e}^{-i m \pi \theta_{1,2}}} & \cdots & \sum_{m=0}^{M-1}{\mbox{e}^{-i m \pi \theta_{1,N}}} \ \sum_{m=0}^{M-1}{\mbox{e}^{-i m \pi \theta_{2,1}}} & M & \cdots & \sum_{m=0}^{M-1}{\mbox{e}^{-i m \pi \theta_{2,N}}}\ \vdots & \vdots & \ddots & \vdots \ \sum_{m=0}^{M-1}{\mbox{e}^{-i m \pi \theta_{N,1}}} & \sum_{m=0}^{M-1}{\mbox{e}^{-i m \pi \theta_{N,2}}} & \cdots & M \ \end{array} \right] \end{split}$$$$

where $$\theta_{i,j} = \theta_{j,i}$$.

I would like to know if there is a closed form for $$$$Tr\left[ (\mathbf{DW})^k \right],$$$$ where $$Tr[.]$$ is the matrix trace operator and $$k$$ is an integer greater than or equal to 1.

So far I have been able to manually find up to $$Tr\left[ (\mathbf{DW})^3 \right]$$ but it gets too cumbersome for $$k \geq 4$$. But perhaps, hopefully, someone out there knows a closed form for this.

## Counting number of states from a regular expression

Given the regular expression: $$r=ab+((a+\epsilon)c^*)^*$$. Let A be a non-deterministic automaton that accepts the language of r. How many states are in A? Answer the question without building A explicitly, explain how you got the answer.

I’m having trouble figuring this question out. The answer that was given is: $$5*2+4*2=18$$

With the explanation that for the $$\epsilon$$ regular expression we build an automaton with 2 states.

for each $$\sigma \in \Sigma$$ for the regular expression $$\sigma$$ we build an automaton with 2 states

For concatenating we do not add states and for each union or star operation we add 2 states.

But even with this explanation I’m not quite sure did they reach this answer.

I can understand that we have $$\epsilon$$, so we have 2. Plus we have $$\Sigma = \{a,b,c\}$$ so we do $$2*3$$.

Even with the stars, how do we reach $$5*2$$?

Also I haven’t seen this kind of calculation before, are there any additional rules when trying to calculate states from a regular expression?

## sed: -e expression #1, char 3: extra characters after command

I’m totally new (starting from 0) to the world of Linux, programming and ‘ask ubuntu’.I have just started experimenting as I’m working on a uni project that requires me to.

I am trying to run an example :

sed '$LNZs/.*/N_Z = 1/' <>$  FTNZ 

and I keep getting the error in the title.

I would appreciate any help as I couldn’t figure out from answers to previous questions having close to ‘0’ basic knowledge atm.

Thanks

## sed: -e expression #1, char 3: extra characters after command

I’m totally new (starting from 0) to the world of Linux, programming and ‘ask ubuntu’.I have just started experimenting as I’m working on a uni project that requires me to.

I am trying to run an example :

sed '$LNZs/.*/N_Z = 1/' <>$  FTNZ 

and I keep getting the error in the title.

I would appreciate any help as I couldn’t figure out from answers to previous questions having close to ‘0’ basic knowledge atm.

Thanks